From 4db609dc78280656845ecb1ab8a7097e1f8600a4 Mon Sep 17 00:00:00 2001 From: zhandouxiaojiji Date: Thu, 22 Oct 2020 10:18:40 +0800 Subject: [PATCH] Tabs close --- render-process/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/render-process/index.tsx b/render-process/index.tsx index b41e0f1..397aa58 100644 --- a/render-process/index.tsx +++ b/render-process/index.tsx @@ -268,6 +268,17 @@ export default class Main extends Component { onChange={activeKey => { this.setState({ curPath: activeKey }) }} + onEdit={(targetKey, action) => { + if (action == 'remove') { + const idx = filepaths.indexOf(targetKey as string); + if(idx < 0) { + return; + } + filepaths.splice(idx, 1); + const nextPath = filepaths[idx - 1]; + this.setState({ filepaths, curPath: nextPath }); + } + }} > { filepaths.map(filepath => {