Tabs close

This commit is contained in:
zhandouxiaojiji committed 2020-10-22 10:18:40 +08:00
1 parent 1d1c6fded2
commit 4db609dc78
1 file changed
+11
+11
View File
@@ -268,6 +268,17 @@ export default class Main extends Component {
onChange={activeKey => { onChange={activeKey => {
this.setState({ curPath: 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 => { filepaths.map(filepath => {