Przeglądaj źródła

2个总账从其他tab栏切换,就手动刷新页面

shaogen1995 4 lat temu
rodzic
commit
58516fe377

+ 2 - 0
src/components/tabLeft.vue

@@ -35,6 +35,8 @@ export default {
   methods: {
     skip (index) {
       this.$router.push(`/layout/holding${index}`).catch(() => {})
+      // 如果从别的tab栏点击藏品总账,就自动刷新页面获取最新信息
+      if (this.ind !== index && index === 3) location.reload(true)
     }
   }
 }

+ 2 - 0
src/components/tabLeft2.vue

@@ -32,6 +32,8 @@ export default {
   methods: {
     skip (index) {
       this.$router.push(`/layout/collect${index}`).catch(() => {})
+      // 如果从别的tab栏点击藏品总账,就自动刷新页面获取最新信息
+      if (this.ind !== index && index === 0) location.reload(true)
     }
   }
 }

+ 6 - 2
src/views/layout/index.vue

@@ -20,7 +20,7 @@
               <li
                 v-for="(val, ind) in item.son"
                 :key="ind"
-                @click="skip(item, val.id)"
+                @click="skip(item, val.id,val.name)"
               >
                 {{ val.name }}
               </li>
@@ -216,9 +216,13 @@ export default {
           })
         })
     },
-    skip (item, ind) {
+    skip (item, ind, name) {
       this.$router.push(item.push + ind).catch(() => {})
       this.isShow = 0
+      // 如果从别的tab栏点击藏品总账,就自动刷新页面获取最新信息  location.reload(true)
+      setTimeout(() => {
+        if (name === '藏品总账' || name === '征集品总账') location.reload(true)
+      }, 100)
     },
     toHome (index) {
       if (index === 0) this.$router.push('/layout/home')