Skip to content

Commit 0ee24af

Browse files
committed
修复多级页面关闭后再打开还缓存的bug
1 parent c336aef commit 0ee24af

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/components/main/components/tags-nav/tags-nav.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
:key="`tag-nav-${index}`"
3535
:name="item.name"
3636
:data-route-item="item"
37-
@on-close="handleClose(item)"
37+
@on-close="close(item)"
3838
@click.native="handleClick(item)"
3939
:closable="item.name !== $config.homeName"
4040
:color="isCurrentTag(item) ? 'primary' : 'default'"

src/components/main/main.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ export default {
104104
'setTagNavList',
105105
'addTag',
106106
'setLocal',
107-
'setHomeRoute'
107+
'setHomeRoute',
108+
'closeTag'
108109
]),
109110
...mapActions([
110111
'handleLogin',
@@ -140,6 +141,7 @@ export default {
140141
this.$router.push(nextRoute)
141142
}
142143
}
144+
this.closeTag(route)
143145
this.setTagNavList(res)
144146
},
145147
handleClick (item) {

src/components/parent-view/parent-view.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
<template>
2-
<keep-alive :exclude="notCacheName">
2+
<keep-alive :include="cacheList" :exclude="notCacheName">
33
<router-view ref="child"/>
44
</keep-alive>
55
</template>
66
<script>
77
export default {
88
name: 'ParentView',
9-
data () {
10-
return {
11-
cacheChaildName: ''
12-
}
13-
},
149
computed: {
10+
tagNavList () {
11+
return this.$store.state.app.tagNavList
12+
},
1513
notCacheName () {
16-
return (this.$route.meta && this.$route.meta.notCache) ? this.$route.name : ''
14+
return [(this.$route.meta && this.$route.meta.notCache) ? this.$route.name : '']
15+
},
16+
cacheList () {
17+
return ['ParentView', ...this.tagNavList.length ? this.tagNavList.filter(item => !(item.meta && item.meta.notCache)).map(item => item.name) : []]
1718
}
1819
}
1920
}

0 commit comments

Comments
 (0)