Selaa lähdekoodia

支持TAB 当前页面刷新

mo 5 vuotta sitten
vanhempi
commit
0523bd213e
2 muutettua tiedostoa jossa 24 lisäystä ja 3 poistoa
  1. 19 1
      src/App.vue
  2. 5 2
      src/layout/components/TagsView.vue

+ 19 - 1
src/App.vue

@@ -1,13 +1,31 @@
 <template>
   <div id="app"
        v-cloak>
-    <router-view />
+    <router-view v-if="isRouterAlive" />
   </div>
 </template>
 
 <script>
 export default {
   name: 'App',
+  provide () {
+    return {
+      reloads: this.reloads
+    }
+  },
+  data () {
+    return {
+      isRouterAlive: true
+    }
+  },
+  methods: {
+    reloads () {
+      this.isRouterAlive = false
+      this.$nextTick(function () {
+        this.isRouterAlive = true
+      })
+    }
+  }
 }
 </script>
 <style >

+ 5 - 2
src/layout/components/TagsView.vue

@@ -41,6 +41,7 @@ export default {
       selectedTag: {}
     }
   },
+  inject: ['reloads'],
   computed: {
     visitedViews () {
       return this.$store.state.tagsView.visitedViews
@@ -129,9 +130,11 @@ export default {
     closeMenu () {
       this.visible = false
     },
-    refresh (view) {
+    async refresh (view) {
       // this.$router.push(view.fullPath)
-      location.reload()
+      // location.reload()
+      this.reloads()
+      console.log(this.reloads)
     }
   }
 }