Unverified Commit 32645b39 by Sendya

fix: multi-tab mode always component keep-alive & cleanup eslint

Signed-off-by: 's avatarSendya <18x@loacg.com>
parent fe5a9e71
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
} }
this.pages = this.pages.filter(page => page.fullPath !== targetKey) this.pages = this.pages.filter(page => page.fullPath !== targetKey)
this.fullPathList = this.fullPathList.filter(path => path !== targetKey) this.fullPathList = this.fullPathList.filter(path => path !== targetKey)
}, }
}, },
watch: { watch: {
'$route': function (newVal) { '$route': function (newVal) {
...@@ -53,4 +53,4 @@ export default { ...@@ -53,4 +53,4 @@ export default {
} }
} }
} }
</script> </script>
\ No newline at end of file
import MultiTab from './MultiTab' import MultiTab from './MultiTab'
export default MultiTab export default MultiTab
\ No newline at end of file
...@@ -5,7 +5,7 @@ export default { ...@@ -5,7 +5,7 @@ export default {
return {} return {}
}, },
render () { render () {
const { $route: { meta } } = this const { $route: { meta }, $store: { getters } } = this
const inKeep = ( const inKeep = (
<keep-alive> <keep-alive>
...@@ -15,7 +15,10 @@ export default { ...@@ -15,7 +15,10 @@ export default {
const notKeep = ( const notKeep = (
<router-view /> <router-view />
) )
return meta.keepAlive ? inKeep : notKeep // 这里增加了 multiTab 的判断,当开启了 multiTab 时
// 应当全部组件皆缓存,否则会导致切换页面后页面还原成原始状态
// 若确实不需要,可改为 return meta.keepAlive ? inKeep : notKeep
return meta.keepAlive || getters.multiTab ? inKeep : notKeep
} }
} }
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment