Commit e76e7b0e authored by zhu-mingye's avatar zhu-mingye

fix tabs close_other can not close first tab

parent f57b3157
...@@ -360,16 +360,14 @@ const Model: ModelType = { ...@@ -360,16 +360,14 @@ const Model: ModelType = {
closeTabs(state, {payload}) { closeTabs(state, {payload}) {
const {deleteType, current} = payload; const {deleteType, current} = payload;
const newTabs = state.tabs; const newTabs = state.tabs;
const firstKey = newTabs.panes[0].key;
let newCurrent = newTabs.panes[0]; let newCurrent = newTabs.panes[0];
if (deleteType == 'CLOSE_OTHER') { if (deleteType == 'CLOSE_OTHER') {
const keys = [firstKey, current.key]; const keys = [current.key];
newCurrent = current; newCurrent = current;
newTabs.activeKey = current.key; newTabs.activeKey = current.key;
newTabs.panes = newTabs.panes.filter(item => keys.includes(item.key)); newTabs.panes = newTabs.panes.filter(item => keys.includes(item.key));
} else { } else {
newTabs.panes = []; newTabs.panes = [];
newTabs.activeKey = firstKey
} }
return { return {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment