keepAlive

Former-commit-id: 4e2c99a5eb914796080ee784db3c7805741e529a [formerly 4e2c99a5eb914796080ee784db3c7805741e529a [formerly 4e2c99a5eb914796080ee784db3c7805741e529a [formerly 4e2c99a5eb914796080ee784db3c7805741e529a [formerly 0673d79b0c2bf8f305834ec81cbf966776452d8c [formerly e086649eb11bbf0161279601fedc27f61306cf6c]]]]]
Former-commit-id: bc0fbc7b16fbb174c50b1ebac650112de349017d
Former-commit-id: 525a8205e35fc7e21666fc9c902be67356a0a901
Former-commit-id: e84543902a51d1d26008d67ff8de0e1848ee3af3 [formerly 5af200b4d0c4a75ae10ead931e9767e66e2742fb]
Former-commit-id: 5d4c68bf8fced815af9808cc63500272ecdfb214
Former-commit-id: af97711a8a7dfead7ea572bbc0a6169ef79a2ce3
Former-commit-id: e0feb7ebcfbf746a859c25435f087ec7dc9d5f85
Former-commit-id: 43cb13c42677b7d08f8971990716593ec37dba96
Former-commit-id: b06a25b1d92afe7faffc795122d99d6ce7d563f4
This commit is contained in:
liyang
2018-09-10 16:53:53 +08:00
parent 01cbe159ab
commit fea87f6e7f
2 changed files with 11 additions and 10 deletions

View File

@@ -108,12 +108,12 @@ export default {
}, },
computed: { computed: {
...mapState('d2admin', { ...mapState('d2admin', {
keepAlive: state => state.page.keepAlive,
grayActive: state => state.gray.active, grayActive: state => state.gray.active,
transitionActive: state => state.transition.active, transitionActive: state => state.transition.active,
asideCollapse: state => state.menu.asideCollapse asideCollapse: state => state.menu.asideCollapse
}), }),
...mapGetters('d2admin', { ...mapGetters('d2admin', {
keepAlive: 'page/keepAlive',
themeActiveSetting: 'theme/activeSetting' themeActiveSetting: 'theme/activeSetting'
}), }),
/** /**

View File

@@ -9,15 +9,18 @@ export default {
// 当前显示的多页面列表 // 当前显示的多页面列表
opened: setting.page.opened, opened: setting.page.opened,
// 当前页面 // 当前页面
current: '' current: '',
// 需要缓存的页面 name
keepAlive: []
}, },
getters: { mutations: {
/** /**
* @description 从当前所有打开的多标签页里返回需要缓存的页面 name * @class keepAlive
* @param {*} state vuex state * @description 从已经打开的页面记录中更新需要缓存的页面记录
* @param {Object} state vuex state
*/ */
keepAlive (state) { updateKeepAliveFromOpened (state) {
return state.opened.filter(item => { state.keepAlive = state.opened.filter(item => {
if (item.meta) { if (item.meta) {
if (item.meta.notCache) { if (item.meta.notCache) {
return false return false
@@ -25,9 +28,7 @@ export default {
} }
return true return true
}).map(e => e.name) }).map(e => e.name)
}
}, },
mutations: {
/** /**
* @class current * @class current
* @description 打开一个新的页面 * @description 打开一个新的页面