Przeglądaj źródła

add auto refresh

ethan 6 lat temu
rodzic
commit
cd2565b514
2 zmienionych plików z 6 dodań i 12 usunięć
  1. 2 7
      src/App.vue
  2. 4 5
      src/views/layout/components/AppMain.vue

+ 2 - 7
src/App.vue

@@ -1,17 +1,12 @@
1 1
 <template>
2 2
   <div id="app">
3
-    <router-view :key="key"></router-view>
3
+    <router-view></router-view>
4 4
   </div>
5 5
 </template>
6 6
 
7 7
 <script>
8 8
 export default {
9
-  name: 'app',
10
-  computed: {
11
-    key() {
12
-        return this.$route.name !== undefined? this.$route.name + +new Date(): this.$route + +new Date()
13
-    }
14
- }
9
+  name: 'app'
15 10
 }
16 11
 </script>
17 12
 

+ 4 - 5
src/views/layout/components/AppMain.vue

@@ -1,8 +1,7 @@
1 1
 <template>
2 2
   <section class="app-main">
3 3
     <transition name="fade" mode="out-in">
4
-      <!-- <router-view :key="key"></router-view> -->
5
-      <router-view></router-view>
4
+      <router-view :key="key"></router-view>
6 5
     </transition>
7 6
   </section>
8 7
 </template>
@@ -11,9 +10,9 @@
11 10
 export default {
12 11
   name: 'AppMain',
13 12
   computed: {
14
-    // key() {
15
-    //   return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
16
-    // }
13
+    key() {
14
+      return this.$route.name !== undefined ? this.$route.name + +new Date() : this.$route + +new Date()
15
+    }
17 16
   }
18 17
 }
19 18
 </script>