1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-09-01 13:33:58 +08:00

优化:顶部标签缓存数组,删除元素

This commit is contained in:
monkeycf 2019-10-03 21:07:44 +08:00 committed by monkeycf
parent 2b1b49dbe7
commit de21045e69

View File

@ -28,13 +28,8 @@ const mutations = {
}
},
DEL_CACHED_VIEW: (state, view) => {
for (const i of state.cachedViews) {
if (i === view.name) {
const index = state.cachedViews.indexOf(i)
state.cachedViews.splice(index, 1)
break
}
}
const index = state.cachedViews.indexOf(view.name)
index > -1 && state.cachedViews.splice(index, 1)
},
DEL_OTHERS_VISITED_VIEWS: (state, view) => {
@ -43,13 +38,8 @@ const mutations = {
})
},
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
for (const i of state.cachedViews) {
if (i === view.name) {
const index = state.cachedViews.indexOf(i)
state.cachedViews = state.cachedViews.slice(index, index + 1)
break
}
}
const index = state.cachedViews.indexOf(view.name)
index > -1 && (state.cachedViews = state.cachedViews.slice(index, index + 1))
},
DEL_ALL_VISITED_VIEWS: state => {