diff --git a/src/store/modules/d2admin/modules/page.js b/src/store/modules/d2admin/modules/page.js index 497e1526..412c5134 100644 --- a/src/store/modules/d2admin/modules/page.js +++ b/src/store/modules/d2admin/modules/page.js @@ -222,9 +222,7 @@ export default { */ update ({ state }, { tagName, title }) { const index = state.opened.findIndex(page => page.fullPath === tagName) - if (index === 0) { - return - } + if (index === 0) return if (title && state.opened[index]) { state.opened[index].meta.title = title } @@ -244,10 +242,7 @@ export default { if (currentIndex > 0) { // 删除打开的页面 并在缓存设置中删除 for (let i = state.opened.length - 1; i >= 0; i--) { - if (state.opened[i].name === 'index' || i >= currentIndex) { - continue - } - + if (state.opened[i].name === 'index' || i >= currentIndex) continue commit('keepAliveRemove', state.opened[i].name) state.opened.splice(i, 1) } @@ -272,10 +267,7 @@ export default { }) // 删除打开的页面 并在缓存设置中删除 for (let i = state.opened.length - 1; i >= 0; i--) { - if (state.opened[i].name === 'index' || currentIndex >= i) { - continue - } - + if (state.opened[i].name === 'index' || currentIndex >= i) continue commit('keepAliveRemove', state.opened[i].name) state.opened.splice(i, 1) } @@ -299,10 +291,7 @@ export default { }) // 删除打开的页面数据 并更新缓存设置 for (let i = state.opened.length - 1; i >= 0; i--) { - if (state.opened[i].name === 'index' || currentIndex === i) { - continue - } - + if (state.opened[i].name === 'index' || currentIndex === i) continue commit('keepAliveRemove', state.opened[i].name) state.opened.splice(i, 1) } @@ -320,10 +309,7 @@ export default { async closeAll ({ state, commit, dispatch }) { // 删除打开的页面 并在缓存设置中删除 for (let i = state.opened.length - 1; i >= 0; i--) { - if (state.opened[i].name === 'index') { - continue - } - + if (state.opened[i].name === 'index') continue commit('keepAliveRemove', state.opened[i].name) state.opened.splice(i, 1) } @@ -395,11 +381,9 @@ export default { routes.forEach(route => { if (route.children && route.children.length > 0) { push(route.children) - } else { - if (!route.hidden) { - const { meta, name, path } = route - pool.push({ meta, name, path }) - } + } else if (!route.hidden) { + const { meta, name, path } = route + pool.push({ meta, name, path }) } }) }