Эх сурвалжийг харах

Улучшил отзывчивость historyPage при открытии

Book Pauk 6 жил өмнө
parent
commit
2598538de9

+ 5 - 1
client/components/Reader/HistoryPage/HistoryPage.vue

@@ -43,6 +43,7 @@
                                 placeholder="Найти"/-->
                                 <div class="el-input el-input--mini">
                                     <input class="el-input__inner"
+                                        ref="input"
                                         placeholder="Найти"
                                         style="margin: 0; padding: 0; vertical-align: bottom; margin-top: 20px; padding: 0 10px 0 10px"
                                         :value="search" @input="search = $event.target.value"
@@ -118,9 +119,12 @@ class HistoryPage extends Vue {
     created() {
     }
 
-    mounted() {
+    init() {
         this.updateTableData();
         this.mostRecentBook = bookManager.mostRecentBook();
+        this.$nextTick(() => {
+            this.$refs.input.focus();
+        });
     }
 
     updateTableData() {

+ 4 - 1
client/components/Reader/Reader.vue

@@ -69,7 +69,7 @@
                 @stop-text-search="stopTextSearch">
             </SearchPage>
             <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @copy-text-toggle="copyTextToggle"></CopyTextPage>            
-            <HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
+            <HistoryPage v-show="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
             <SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
             <HelpPage v-if="helpActive" ref="helpPage" @help-toggle="helpToggle"></HelpPage>
             <ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
@@ -415,6 +415,7 @@ class Reader extends Vue {
         this.historyActive = !this.historyActive;
         if (this.historyActive) {
             this.closeAllTextPages();
+            this.$refs.historyPage.init();
             this.historyActive = true;
         } else {
             this.historyActive = false;
@@ -831,6 +832,8 @@ class Reader extends Vue {
                             break;
                         case 'KeyX':
                             this.historyToggle();
+                            event.preventDefault();
+                            event.stopPropagation();
                             break;
                         case 'KeyS':
                             this.settingsToggle();