wolyshaw 4 years ago
parent
commit
202cf54299
2 changed files with 5 additions and 3 deletions
  1. 0 1
      src/components/Pagination/index.vue
  2. 5 2
      src/helpers/index.js

+ 0 - 1
src/components/Pagination/index.vue

@@ -79,7 +79,6 @@ export default {
   mounted() {
     if (this.sync) {
       const searchs = new Searchs(this.$route.fullPath)
-      console.log(searchs)
       const active = searchs.get()
       if (active && active.page) {
         for (const key in active.page) {

+ 5 - 2
src/helpers/index.js

@@ -19,10 +19,10 @@ export class Searchs {
   }
 
   parse() {
-    let json = {}
+    let json = {...initSearch}
     try {
       const val = sessionStorage.getItem(this.saveKey)
-      json = JSON.parse(val) || initSearch
+      json = JSON.parse(val) || json
     } catch (error) {}
     return json
   }
@@ -61,6 +61,9 @@ export class Searchs {
 
   update(data, key, type) {
     const k = (key || this.key)
+    if (!this.searchs[k]) {
+      this.searchs[k] = {...initSearch}
+    }
     if (type) {
       this.searchs[k][type] = data
     } else {