Selaa lähdekoodia

add auto refresh

ethan 6 vuotta sitten
vanhempi
commit
cd2565b514
2 muutettua tiedostoa jossa 6 lisäystä ja 12 poistoa
  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>