|
|
|
@ -44,17 +44,24 @@ const mutations = {
|
|
|
|
|
state.tabList.push(tab);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
closeTab: (state, { index, reverse }) => {
|
|
|
|
|
if (typeof index === 'undefined') {
|
|
|
|
|
state.tabList.splice(1);
|
|
|
|
|
closeTab: (state, { index, reverse, current }) => {
|
|
|
|
|
if (current) {
|
|
|
|
|
state.tabList.splice(
|
|
|
|
|
state.tabList.findIndex((item) => item.name === state.activeTab),
|
|
|
|
|
1
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
if (reverse) {
|
|
|
|
|
let tab = state.tabList[index];
|
|
|
|
|
router.push(tab.fullPath);
|
|
|
|
|
state.tabList = [tab];
|
|
|
|
|
} else if (state.tabList.length > 1) {
|
|
|
|
|
state.tabList.splice(index, 1);
|
|
|
|
|
router.push(state.tabList[Math.min(index, state.tabList.length - 1)].fullPath);
|
|
|
|
|
if (typeof index === 'undefined') {
|
|
|
|
|
state.tabList.splice(1);
|
|
|
|
|
} else {
|
|
|
|
|
if (reverse) {
|
|
|
|
|
let tab = state.tabList[index];
|
|
|
|
|
router.push(tab.fullPath);
|
|
|
|
|
state.tabList = [tab];
|
|
|
|
|
} else if (state.tabList.length > 1) {
|
|
|
|
|
state.tabList.splice(index, 1);
|
|
|
|
|
router.push(state.tabList[Math.min(index, state.tabList.length - 1)].fullPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|