Merge branch '2.0'

This commit is contained in:
zhigang.li 2018-12-27 15:20:26 +08:00
commit 1124878133
3 changed files with 12 additions and 9 deletions

View File

@ -34,7 +34,7 @@
:key="`tag-nav-${index}`"
:name="item.name"
:data-route-item="item"
@on-close="handleClose(item)"
@on-close="close(item)"
@click.native="handleClick(item)"
:closable="item.name !== $config.homeName"
:color="isCurrentTag(item) ? 'primary' : 'default'"

View File

@ -104,7 +104,8 @@ export default {
'setTagNavList',
'addTag',
'setLocal',
'setHomeRoute'
'setHomeRoute',
'closeTag'
]),
...mapActions([
'handleLogin',
@ -140,6 +141,7 @@ export default {
this.$router.push(nextRoute)
}
}
this.closeTag(route)
this.setTagNavList(res)
},
handleClick (item) {

View File

@ -1,19 +1,20 @@
<template>
<keep-alive :exclude="notCacheName">
<keep-alive :include="cacheList" :exclude="notCacheName">
<router-view ref="child"/>
</keep-alive>
</template>
<script>
export default {
name: 'ParentView',
data () {
return {
cacheChaildName: ''
}
},
computed: {
tagNavList () {
return this.$store.state.app.tagNavList
},
notCacheName () {
return (this.$route.meta && this.$route.meta.notCache) ? this.$route.name : ''
return [(this.$route.meta && this.$route.meta.notCache) ? this.$route.name : '']
},
cacheList () {
return ['ParentView', ...this.tagNavList.length ? this.tagNavList.filter(item => !(item.meta && item.meta.notCache)).map(item => item.name) : []]
}
}
}