Browse Source

add auto refresh

ethan 6 years ago
parent
commit
cd2565b514
2 changed files with 6 additions and 12 deletions
  1. 2 7
      src/App.vue
  2. 4 5
      src/views/layout/components/AppMain.vue

+ 2 - 7
src/App.vue

1
 <template>
1
 <template>
2
   <div id="app">
2
   <div id="app">
3
-    <router-view :key="key"></router-view>
3
+    <router-view></router-view>
4
   </div>
4
   </div>
5
 </template>
5
 </template>
6
 
6
 
7
 <script>
7
 <script>
8
 export default {
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
 </script>
11
 </script>
17
 
12
 

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

1
 <template>
1
 <template>
2
   <section class="app-main">
2
   <section class="app-main">
3
     <transition name="fade" mode="out-in">
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
     </transition>
5
     </transition>
7
   </section>
6
   </section>
8
 </template>
7
 </template>
11
 export default {
10
 export default {
12
   name: 'AppMain',
11
   name: 'AppMain',
13
   computed: {
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
 </script>
18
 </script>