File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export default {
3838 }
3939 this .pages = this .pages .filter (page => page .fullPath !== targetKey)
4040 this .fullPathList = this .fullPathList .filter (path => path !== targetKey)
41- },
41+ }
4242 },
4343 watch: {
4444 ' $route ' : function (newVal ) {
@@ -53,4 +53,4 @@ export default {
5353 }
5454 }
5555}
56- </script >
56+ </script >
Original file line number Diff line number Diff line change 11import MultiTab from './MultiTab'
2- export default MultiTab
2+ export default MultiTab
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export default {
55 return {}
66 },
77 render () {
8- const { $route: { meta } } = this
8+ const { $route: { meta }, $store : { getters } } = this
99
1010 const inKeep = (
1111 < keep- alive>
@@ -15,7 +15,10 @@ export default {
1515 const notKeep = (
1616 < router- view / >
1717 )
18- return meta .keepAlive ? inKeep : notKeep
18+ // 这里增加了 multiTab 的判断,当开启了 multiTab 时
19+ // 应当全部组件皆缓存,否则会导致切换页面后页面还原成原始状态
20+ // 若确实不需要,可改为 return meta.keepAlive ? inKeep : notKeep
21+ return meta .keepAlive || getters .multiTab ? inKeep : notKeep
1922 }
2023}
21- </script >
24+ </script >
You can’t perform that action at this time.
0 commit comments