hookehuyr

keepAlive缓存机制重写

1 <template> 1 <template>
2 <!-- 页面缓存 --> 2 <!-- 页面缓存 -->
3 <router-view v-slot="{ Component }"> 3 <router-view v-slot="{ Component }">
4 - <keep-alive> 4 + <keep-alive :include="keepPages">
5 - <component :is="Component" :key="$route.name" v-if="$route.meta.keepAlive" /> 5 + <component :is="Component" :key="$route.name" />
6 </keep-alive> 6 </keep-alive>
7 - <component :is="Component" :key="$route.name" v-if="!$route.meta.keepAlive" />
8 </router-view> 7 </router-view>
9 </template> 8 </template>
10 9
11 <script setup> 10 <script setup>
11 +import { mainStore } from '@/store'
12 +import { storeToRefs } from 'pinia'
13 +import { computed, ref } from 'vue';
14 +
15 +// 使用 include + pinia 状态管理动态缓存页面
16 +const store = mainStore()
17 +
18 +const keepPages = computed(() => {
19 + return store.getKeepPages
20 +})
12 21
13 </script> 22 </script>
14 23
......
...@@ -19,9 +19,6 @@ const emit = defineEmits(['on-click']); ...@@ -19,9 +19,6 @@ const emit = defineEmits(['on-click']);
19 const handle = () => { 19 const handle = () => {
20 emit('on-click', '') 20 emit('on-click', '')
21 } 21 }
22 - onMounted(() => {
23 -
24 - })
25 </script> 22 </script>
26 23
27 <script> 24 <script>
......
...@@ -36,7 +36,8 @@ export default [{ ...@@ -36,7 +36,8 @@ export default [{
36 component: () => import('./views/client/bookDetail.vue'), 36 component: () => import('./views/client/bookDetail.vue'),
37 meta: { 37 meta: {
38 title: '书籍', 38 title: '书籍',
39 - keepAlive: true 39 + keepAlive: true,
40 + name: 'bookDetail'
40 }, 41 },
41 children: [] 42 children: []
42 }, { 43 }, {
...@@ -99,7 +100,8 @@ export default [{ ...@@ -99,7 +100,8 @@ export default [{
99 component: () => import('./views/client/personIndex.vue'), 100 component: () => import('./views/client/personIndex.vue'),
100 meta: { 101 meta: {
101 title: '个人首页', 102 title: '个人首页',
102 - keepAlive: true 103 + keepAlive: true,
104 + name: 'personIndex'
103 }, 105 },
104 children: [] 106 children: []
105 }, { 107 }, {
...@@ -172,7 +174,8 @@ export default [{ ...@@ -172,7 +174,8 @@ export default [{
172 component: () => import('./views/me/message.vue'), 174 component: () => import('./views/me/message.vue'),
173 meta: { 175 meta: {
174 title: '我的留言', 176 title: '我的留言',
175 - keepAlive: true 177 + keepAlive: true,
178 + name: 'message'
176 }, 179 },
177 children: [] 180 children: []
178 }, { 181 }, {
...@@ -181,7 +184,8 @@ export default [{ ...@@ -181,7 +184,8 @@ export default [{
181 component: () => import('./views/me/callMe.vue'), 184 component: () => import('./views/me/callMe.vue'),
182 meta: { 185 meta: {
183 title: '@我的', 186 title: '@我的',
184 - keepAlive: true 187 + keepAlive: true,
188 + name: 'callMe'
185 }, 189 },
186 children: [] 190 children: []
187 }, { 191 }, {
...@@ -198,7 +202,8 @@ export default [{ ...@@ -198,7 +202,8 @@ export default [{
198 component: () => import('./views/me/unwatchList.vue'), 202 component: () => import('./views/me/unwatchList.vue'),
199 meta: { 203 meta: {
200 title: '未看作品', 204 title: '未看作品',
201 - keepAlive: true 205 + keepAlive: true,
206 + name: 'unwatchList'
202 }, 207 },
203 children: [] 208 children: []
204 }, { 209 }, {
......
1 import { defineStore } from 'pinia'; 1 import { defineStore } from 'pinia';
2 +import _ from 'lodash';
2 3
3 export const mainStore = defineStore('main', { 4 export const mainStore = defineStore('main', {
4 state: () => { 5 state: () => {
...@@ -11,9 +12,14 @@ export const mainStore = defineStore('main', { ...@@ -11,9 +12,14 @@ export const mainStore = defineStore('main', {
11 scrollTop: 0, 12 scrollTop: 0,
12 scrollTopCollection: 0, 13 scrollTopCollection: 0,
13 scrollTopLike: 0, 14 scrollTopLike: 0,
15 + keepPages: 'default', // 很坑爹,空值全部都缓存
14 }; 16 };
15 }, 17 },
16 - getters: {}, 18 + getters: {
19 + getKeepPages (state) {
20 + return state.keepPages
21 + }
22 + },
17 actions: { 23 actions: {
18 changeState (state) { 24 changeState (state) {
19 this.auth = state; 25 this.auth = state;
...@@ -33,5 +39,21 @@ export const mainStore = defineStore('main', { ...@@ -33,5 +39,21 @@ export const mainStore = defineStore('main', {
33 changeScrollTopLike (v) { 39 changeScrollTopLike (v) {
34 this.scrollTopLike = v; 40 this.scrollTopLike = v;
35 }, 41 },
42 + changeKeepPages (page) { // 清空所有缓存,用一个不存在的值覆盖
43 + this.keepPages = page;
44 + },
45 + keepThisPage (page) { // 新增缓存页
46 + const arr = this.keepPages.split(",");
47 + arr.push(page);
48 + this.keepPages = arr + "";
49 + },
50 + removeThisPage (page) { // 删除缓存页
51 + const arr = this.keepPages.split(",");
52 + const index = arr.findIndex(x => x === page);
53 + if (index > 0) {
54 + arr.splice(index, 1);
55 + }
56 + this.keepPages = arr + "";
57 + }
36 }, 58 },
37 }); 59 });
......
...@@ -136,7 +136,7 @@ import no_image from '@images/que-shuju@2x.png' ...@@ -136,7 +136,7 @@ import no_image from '@images/que-shuju@2x.png'
136 136
137 import ShortcutFixed from '@/components/ShortcutFixed/index.vue' 137 import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
138 import tools from '@/common/tool' 138 import tools from '@/common/tool'
139 -import { ref, nextTick, onActivated } from 'vue' 139 +import { ref, nextTick, onActivated, onMounted } from 'vue'
140 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' 140 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router'
141 import axios from '@/utils/axios'; 141 import axios from '@/utils/axios';
142 import $ from 'jquery' 142 import $ from 'jquery'
...@@ -290,11 +290,13 @@ const uploadVideo = () => { ...@@ -290,11 +290,13 @@ const uploadVideo = () => {
290 290
291 /****************** keepAlive 模块 *******************/ 291 /****************** keepAlive 模块 *******************/
292 292
293 +// TAG: keepAlive 缓存页面
294 +const store = mainStore();
295 +store.keepThisPage($route.meta.name);
296 +
293 onActivated(() => { // keepAlive 重置后执行回调 297 onActivated(() => { // keepAlive 重置后执行回调
294 // TAG: pinia应用,动态刷新数据 298 // TAG: pinia应用,动态刷新数据
295 // 处理数据未刷新数据显示问题 299 // 处理数据未刷新数据显示问题
296 - const store = mainStore()
297 - // Pinia 解构方法:storeToRefs
298 const { video_detail } = storeToRefs(store); 300 const { video_detail } = storeToRefs(store);
299 // 如果作品信息有变化及时修正 301 // 如果作品信息有变化及时修正
300 const arr = ref([]); 302 const arr = ref([]);
...@@ -325,29 +327,6 @@ onActivated(() => { // keepAlive 重置后执行回调 ...@@ -325,29 +327,6 @@ onActivated(() => { // keepAlive 重置后执行回调
325 document.title = $route.meta.title; 327 document.title = $route.meta.title;
326 }); 328 });
327 329
328 -const changeRouterKeepAlive = (path, keepAlive) => {
329 - $router.options.routes.map((item) => {
330 - if (item.path === path) {
331 - item.meta.keepAlive = keepAlive;
332 - }
333 - });
334 -};
335 -
336 -onBeforeRouteLeave((to, from) => {
337 - // 如果是从页面返回,需要重置keepAlive状态
338 - // 列表页 =》 详情页
339 - // TAG: keepAlive
340 - if (to.path === '/client/videoDetail') {
341 - changeRouterKeepAlive(from.path, true);
342 - } else {
343 - changeRouterKeepAlive(from.path, false);
344 - // BUG: 改变keepAlive数据不刷新,只能手动刷新
345 - if (to.path === '/client/chooseBook') {
346 - location.reload()
347 - }
348 - }
349 -})
350 -
351 /*********************************************************/ 330 /*********************************************************/
352 331
353 </script> 332 </script>
...@@ -356,6 +335,7 @@ onBeforeRouteLeave((to, from) => { ...@@ -356,6 +335,7 @@ onBeforeRouteLeave((to, from) => {
356 import mixin from 'common/mixin'; 335 import mixin from 'common/mixin';
357 336
358 export default { 337 export default {
338 + name: 'bookDetail',
359 mixins: [mixin.init], 339 mixins: [mixin.init],
360 data() { 340 data() {
361 return { 341 return {
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
48 48
49 <script setup> 49 <script setup>
50 import { useTitle } from '@vueuse/core' 50 import { useTitle } from '@vueuse/core'
51 +import { mainStore } from '@/store'
51 52
52 import Cookies from 'js-cookie' 53 import Cookies from 'js-cookie'
53 54
...@@ -60,7 +61,7 @@ import ShortcutFixed from '@/components/ShortcutFixed/index.vue' ...@@ -60,7 +61,7 @@ import ShortcutFixed from '@/components/ShortcutFixed/index.vue'
60 61
61 import { bookFn } from '@/composables/useBookList.js' 62 import { bookFn } from '@/composables/useBookList.js'
62 63
63 -import { ref, reactive, nextTick } from 'vue' 64 +import { ref, reactive, onMounted } from 'vue'
64 import { useRoute, useRouter } from 'vue-router' 65 import { useRoute, useRouter } from 'vue-router'
65 import _ from 'lodash' 66 import _ from 'lodash'
66 import axios from '@/utils/axios'; 67 import axios from '@/utils/axios';
...@@ -69,6 +70,10 @@ import { Toast } from 'vant' ...@@ -69,6 +70,10 @@ import { Toast } from 'vant'
69 const $route = useRoute(); 70 const $route = useRoute();
70 const $router = useRouter(); 71 const $router = useRouter();
71 72
73 +// 删除所有的 keep-alive 缓存
74 +const store = mainStore()
75 +store.changeKeepPages('clear');
76 +
72 // 设置页面标题 77 // 设置页面标题
73 useTitle($route.meta.title) 78 useTitle($route.meta.title)
74 79
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
10 </template> 10 </template>
11 11
12 <script setup> 12 <script setup>
13 +import { mainStore } from '@/store'
14 +
13 import RightSideList from '@/components/RightSideList/index.vue' 15 import RightSideList from '@/components/RightSideList/index.vue'
14 16
15 import { ref } from 'vue'; 17 import { ref } from 'vue';
...@@ -19,6 +21,10 @@ import { Toast } from 'vant'; ...@@ -19,6 +21,10 @@ import { Toast } from 'vant';
19 21
20 const $router = useRouter(); 22 const $router = useRouter();
21 23
24 +// 删除所有的 keep-alive 缓存
25 +const store = mainStore()
26 +store.changeKeepPages('clear');
27 +
22 // 跳转幼儿园爱心书籍列表页 28 // 跳转幼儿园爱心书籍列表页
23 const onClick = (item) => { 29 const onClick = (item) => {
24 $router.push({ 30 $router.push({
......
...@@ -136,11 +136,13 @@ const followUser = (status) => { ...@@ -136,11 +136,13 @@ const followUser = (status) => {
136 136
137 /****************** keepAlive 模块 *******************/ 137 /****************** keepAlive 模块 *******************/
138 138
139 +// TAG: keepAlive 缓存页面
140 +const store = mainStore();
141 +store.keepThisPage($route.meta.name);
142 +
139 onActivated(() => { // keepAlive 重置后执行回调 143 onActivated(() => { // keepAlive 重置后执行回调
140 // TAG: pinia应用,动态刷新数据 144 // TAG: pinia应用,动态刷新数据
141 - const store = mainStore()
142 // 处理数据未刷新数据显示问题 145 // 处理数据未刷新数据显示问题
143 - // Pinia 解构方法:storeToRefs
144 const { video_detail } = storeToRefs(store); 146 const { video_detail } = storeToRefs(store);
145 // 如果作品信息有变化及时修正 147 // 如果作品信息有变化及时修正
146 const arr = ref([]); 148 const arr = ref([]);
...@@ -152,31 +154,8 @@ onActivated(() => { // keepAlive 重置后执行回调 ...@@ -152,31 +154,8 @@ onActivated(() => { // keepAlive 重置后执行回调
152 }) 154 })
153 // 触发更新 155 // 触发更新
154 userInfo.value.prod = arr.value; 156 userInfo.value.prod = arr.value;
155 - // BUG: 暂时找不到问题,只能先强制刷新,数据串了。
156 - if (userInfo.value.id && userInfo.value.id !== +$route.query.perf_id) {
157 - location.reload();
158 - }
159 }); 157 });
160 158
161 -const changeRouterKeepAlive = (path, keepAlive) => {
162 - $router.options.routes.map((item) => {
163 - if (item.path === path) {
164 - item.meta.keepAlive = keepAlive;
165 - }
166 - });
167 -};
168 -
169 -onBeforeRouteLeave((to, from) => {
170 - // 如果是从页面返回,需要重置keepAlive状态
171 - // 列表页 =》 详情页
172 - // TAG: keepAlive
173 - if (to.path === '/client/videoDetail' && to.query.type === 'read-only') {
174 - changeRouterKeepAlive(from.path, true);
175 - } else {
176 - changeRouterKeepAlive(from.path, false);
177 - }
178 -})
179 -
180 /*********************************************************/ 159 /*********************************************************/
181 160
182 </script> 161 </script>
...@@ -185,6 +164,7 @@ onBeforeRouteLeave((to, from) => { ...@@ -185,6 +164,7 @@ onBeforeRouteLeave((to, from) => {
185 import mixin from 'common/mixin'; 164 import mixin from 'common/mixin';
186 165
187 export default { 166 export default {
167 + name: 'personIndex',
188 mixins: [mixin.init], 168 mixins: [mixin.init],
189 data() { 169 data() {
190 return { 170 return {
......
...@@ -78,8 +78,7 @@ const tabClass = { ...@@ -78,8 +78,7 @@ const tabClass = {
78 78
79 // 处理主路由的留言数量问题 79 // 处理主路由的留言数量问题
80 const store = mainStore() 80 const store = mainStore()
81 -// Pinia 解构方法:storeToRefs 81 +const { comment_num } = storeToRefs(store);
82 -const { comment_num } = storeToRefs(store)
83 82
84 const videoInfo = ref(''); 83 const videoInfo = ref('');
85 84
...@@ -121,6 +120,11 @@ const onVideoDetail = (v) => { ...@@ -121,6 +120,11 @@ const onVideoDetail = (v) => {
121 // 缓存作品信息,给其他页使用 120 // 缓存作品信息,给其他页使用
122 store.changeVideoDetail(v); 121 store.changeVideoDetail(v);
123 } 122 }
123 +
124 +// 删除个人首页的keep-alive缓存
125 +if (!$route.query.type) { // read-only 页不能删除
126 + store.removeThisPage('personIndex');
127 +}
124 </script> 128 </script>
125 129
126 <script> 130 <script>
......
...@@ -59,6 +59,8 @@ ...@@ -59,6 +59,8 @@
59 </template> 59 </template>
60 60
61 <script setup> 61 <script setup>
62 +import { mainStore } from '@/store'
63 +
62 // import icon_player from '@images/bofang@2x.png' 64 // import icon_player from '@images/bofang@2x.png'
63 import no_image from '@images/que-shuju@2x.png' 65 import no_image from '@images/que-shuju@2x.png'
64 import CommentBox from '@/components/CommentBox/index.vue' 66 import CommentBox from '@/components/CommentBox/index.vue'
...@@ -224,28 +226,13 @@ const onClick = (item) => { ...@@ -224,28 +226,13 @@ const onClick = (item) => {
224 226
225 /****************** keepAlive 模块 *******************/ 227 /****************** keepAlive 模块 *******************/
226 228
229 +// TAG: keepAlive 缓存页面
230 +const store = mainStore();
231 +store.keepThisPage($route.meta.name);
232 +
227 onActivated(() => { // keepAlive 重置后执行回调 233 onActivated(() => { // keepAlive 重置后执行回调
228 }); 234 });
229 235
230 -const changeRouterKeepAlive = (path, keepAlive) => {
231 - $router.options.routes.map((item) => {
232 - if (item.path === path) {
233 - item.meta.keepAlive = keepAlive;
234 - }
235 - });
236 -};
237 -
238 -onBeforeRouteLeave((to, from) => {
239 - // 如果是从页面返回,需要重置keepAlive状态
240 - // 列表页 =》 详情页
241 - // TAG: keepAlive
242 - if (to.path === '/client/bookDetail') {
243 - changeRouterKeepAlive(from.path, true);
244 - } else {
245 - changeRouterKeepAlive(from.path, false);
246 - }
247 -})
248 -
249 /*********************************************************/ 236 /*********************************************************/
250 </script> 237 </script>
251 238
...@@ -253,6 +240,7 @@ onBeforeRouteLeave((to, from) => { ...@@ -253,6 +240,7 @@ onBeforeRouteLeave((to, from) => {
253 import mixin from 'common/mixin'; 240 import mixin from 'common/mixin';
254 241
255 export default { 242 export default {
243 + name: 'callMe',
256 mixins: [mixin.init], 244 mixins: [mixin.init],
257 data () { 245 data () {
258 return { 246 return {
......
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
70 </template> 70 </template>
71 71
72 <script setup> 72 <script setup>
73 +import { mainStore } from '@/store'
74 +
73 import icon_avatar from '@images/que-touxiang@2x.png' 75 import icon_avatar from '@images/que-touxiang@2x.png'
74 76
75 import MyButton from '@/components/MyButton/index.vue' 77 import MyButton from '@/components/MyButton/index.vue'
...@@ -83,6 +85,9 @@ import { Toast } from 'vant'; ...@@ -83,6 +85,9 @@ import { Toast } from 'vant';
83 const $route = useRoute(); 85 const $route = useRoute();
84 const $router = useRouter(); 86 const $router = useRouter();
85 87
88 +// 删除 keep-alive 缓存
89 +const store = mainStore();
90 +store.changeKeepPages('clear');
86 91
87 /********** 切换用户功能 START *************/ 92 /********** 切换用户功能 START *************/
88 93
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
49 </template> 49 </template>
50 50
51 <script setup> 51 <script setup>
52 +import { mainStore } from '@/store'
53 +
52 import icon_player from '@images/bofang@2x.png' 54 import icon_player from '@images/bofang@2x.png'
53 import no_image from '@images/que-shuju@2x.png' 55 import no_image from '@images/que-shuju@2x.png'
54 import icon_avatar from '@images/que-touxiang@2x.png' 56 import icon_avatar from '@images/que-touxiang@2x.png'
...@@ -158,28 +160,13 @@ const deleteComment = (item) => { // 删除评论 ...@@ -158,28 +160,13 @@ const deleteComment = (item) => { // 删除评论
158 160
159 /****************** keepAlive 模块 *******************/ 161 /****************** keepAlive 模块 *******************/
160 162
163 +// TAG: keepAlive 缓存页面
164 +const store = mainStore();
165 +store.keepThisPage($route.meta.name);
166 +
161 onActivated(() => { // keepAlive 重置后执行回调 167 onActivated(() => { // keepAlive 重置后执行回调
162 }); 168 });
163 169
164 -const changeRouterKeepAlive = (path, keepAlive) => {
165 - $router.options.routes.map((item) => {
166 - if (item.path === path) {
167 - item.meta.keepAlive = keepAlive;
168 - }
169 - });
170 -};
171 -
172 -onBeforeRouteLeave((to, from) => {
173 - // 如果是从页面返回,需要重置keepAlive状态
174 - // 列表页 =》 详情页
175 - // TAG: keepAlive
176 - if (to.path === '/client/videoDetail') {
177 - changeRouterKeepAlive(from.path, true);
178 - } else {
179 - changeRouterKeepAlive(from.path, false);
180 - }
181 -})
182 -
183 /*********************************************************/ 170 /*********************************************************/
184 </script> 171 </script>
185 172
...@@ -187,6 +174,7 @@ onBeforeRouteLeave((to, from) => { ...@@ -187,6 +174,7 @@ onBeforeRouteLeave((to, from) => {
187 import mixin from 'common/mixin'; 174 import mixin from 'common/mixin';
188 175
189 export default { 176 export default {
177 + name: 'message',
190 mixins: [mixin.init], 178 mixins: [mixin.init],
191 data() { 179 data() {
192 return { 180 return {
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
17 </template> 17 </template>
18 18
19 <script setup> 19 <script setup>
20 +import { mainStore } from '@/store'
21 +import { storeToRefs } from 'pinia'
22 +
20 import no_image from '@images/que-shuju@2x.png' 23 import no_image from '@images/que-shuju@2x.png'
21 24
22 import { useUnwatchList } from '@/composables/useUnwatchList.js' 25 import { useUnwatchList } from '@/composables/useUnwatchList.js'
...@@ -24,22 +27,24 @@ import { useUnwatchList } from '@/composables/useUnwatchList.js' ...@@ -24,22 +27,24 @@ import { useUnwatchList } from '@/composables/useUnwatchList.js'
24 import VideoCard from '@/components/VideoCard/index.vue' 27 import VideoCard from '@/components/VideoCard/index.vue'
25 28
26 import { ref, onActivated, computed } from 'vue' 29 import { ref, onActivated, computed } from 'vue'
27 -import { mainStore } from '@/store'
28 -import { storeToRefs } from 'pinia'
29 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' 30 import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router'
30 import $ from 'jquery' 31 import $ from 'jquery'
31 import _ from 'lodash'; 32 import _ from 'lodash';
32 import { wxInfo } from '@/utils/tools'; 33 import { wxInfo } from '@/utils/tools';
33 34
35 +const $route = useRoute();
34 const $router = useRouter(); 36 const $router = useRouter();
35 37
36 const { onLoad, prod_list, finished, loading, finishedTextStatus, emptyStatus } = useUnwatchList(); 38 const { onLoad, prod_list, finished, loading, finishedTextStatus, emptyStatus } = useUnwatchList();
37 39
38 /****************** keepAlive 模块 *******************/ 40 /****************** keepAlive 模块 *******************/
39 41
42 +// TAG: keepAlive 缓存页面
43 +const store = mainStore();
44 +store.keepThisPage($route.meta.name);
45 +
40 onActivated(() => { // keepAlive 重置后执行回调 46 onActivated(() => { // keepAlive 重置后执行回调
41 // TAG: pinia应用,动态刷新数据 47 // TAG: pinia应用,动态刷新数据
42 - const store = mainStore()
43 // 处理数据未刷新数据显示问题 48 // 处理数据未刷新数据显示问题
44 // Pinia 解构方法:storeToRefs 49 // Pinia 解构方法:storeToRefs
45 const { video_detail } = storeToRefs(store); 50 const { video_detail } = storeToRefs(store);
...@@ -70,25 +75,6 @@ onActivated(() => { // keepAlive 重置后执行回调 ...@@ -70,25 +75,6 @@ onActivated(() => { // keepAlive 重置后执行回调
70 } 75 }
71 }); 76 });
72 77
73 -const changeRouterKeepAlive = (path, keepAlive) => {
74 - $router.options.routes.map((item) => {
75 - if (item.path === path) {
76 - item.meta.keepAlive = keepAlive;
77 - }
78 - });
79 -};
80 -
81 -onBeforeRouteLeave((to, from) => {
82 - // 如果是从页面返回,需要重置keepAlive状态
83 - // 列表页 =》 详情页
84 - // TAG: keepAlive
85 - if (to.path === '/client/videoDetail' && to.query.type === 'read-only') {
86 - changeRouterKeepAlive(from.path, true);
87 - } else {
88 - changeRouterKeepAlive(from.path, false);
89 - }
90 -})
91 -
92 /*********************************************************/ 78 /*********************************************************/
93 79
94 </script> 80 </script>
...@@ -97,6 +83,7 @@ onBeforeRouteLeave((to, from) => { ...@@ -97,6 +83,7 @@ onBeforeRouteLeave((to, from) => {
97 import mixin from 'common/mixin'; 83 import mixin from 'common/mixin';
98 84
99 export default { 85 export default {
86 + name: 'unwatchList',
100 mixins: [mixin.init], 87 mixins: [mixin.init],
101 data() { 88 data() {
102 return { 89 return {
......