From 1c911df4a0e726ffccd370fca4021e1e63b76743 Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Wed, 26 Aug 2020 14:09:30 +0800 Subject: [PATCH] =?UTF-8?q?style:=20:art:=20=E7=BC=A9=E5=86=99=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=BE=88=E5=B0=8F=E7=9A=84=20if=20=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/d2admin/modules/page.js | 32 ++++++----------------- 1 file changed, 8 insertions(+), 24 deletions(-) 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 }) } }) }