浏览代码

Рефакторинг

Book Pauk 2 年之前
父节点
当前提交
fd93d3f523
共有 2 个文件被更改,包括 7 次插入9 次删除
  1. 2 3
      client/components/Search/AuthorList/AuthorList.vue
  2. 5 6
      client/components/Search/Search.vue

+ 2 - 3
client/components/Search/AuthorList/AuthorList.vue

@@ -189,7 +189,6 @@ class AuthorList extends BaseList {
         list: Object,
         search: Object,
         genreMap: Object,
-        liberamaReady: Boolean,
     };
     
     loadingMessage = '';
@@ -243,7 +242,7 @@ class AuthorList extends BaseList {
     }
 
     get showReadLink() {
-        return this.config.bookReadLink != '' || this.liberamaReady;
+        return this.config.bookReadLink != '' || this.list.liberamaReady;
     }
 
     showHiddenHelp() {
@@ -356,7 +355,7 @@ class AuthorList extends BaseList {
 поэтому повторная попытка должна быть успешной.`, 'Ошибка');
             } else if (action == 'readBook') {
                 //читать
-                if (this.liberamaReady) {
+                if (this.list.liberamaReady) {
                     this.sendMessage({type: 'submitUrl', data: href});
                 } else {
                     const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href);

+ 5 - 6
client/components/Search/Search.vue

@@ -111,7 +111,7 @@
             </div>
 
             <!-- Формирование списка ------------------------------------------------------------------------>
-            <AuthorList :ready="ready" :list="list" :search="search" :genre-map="genreMap" :liberama-ready="liberamaReady" @list-event="listEvent" />
+            <AuthorList :ready="ready" :list="list" :search="search" :genre-map="genreMap" @list-event="listEvent" />
             <!-- Формирование списка конец ------------------------------------------------------------------>
 
             <div class="row justify-center">
@@ -289,6 +289,7 @@ class Search {
         queryFound: -1,
         totalFound: 0,
         inpxHash: '',
+        liberamaReady: false,
     };
 
     genreTree = [];
@@ -310,8 +311,6 @@ class Search {
     searchResult = {};
     tableData = [];
 
-    liberamaReady = false;
-
     created() {
         this.commit = this.$store.commit;
         this.api = this.$root.api;
@@ -365,7 +364,7 @@ class Search {
         if (d.type == 'mes') {
             switch(d.data) {
                 case 'ready':
-                    this.liberamaReady = true;
+                    this.list.liberamaReady = true;
                     this.sendMessage({type: 'mes', data: 'ready'});
                     this.sendCurrentUrl();
                     break;
@@ -447,7 +446,7 @@ class Search {
         }
 
         this.$root.setAppTitle(result);
-        if (this.liberamaReady)
+        if (this.list.liberamaReady)
             this.sendMessage({type: 'titleChange', data: result});
     }
 
@@ -672,7 +671,7 @@ class Search {
     }
 
     async updateSearchFromRouteQuery(to) {
-        if (this.liberamaReady)
+        if (this.list.liberamaReady)
             this.sendCurrentUrl();
             
         if (this.routeUpdating)