diff --git a/src/components/tabs/tab.tsx b/src/components/tabs/tab.tsx index 7557fae6b..103e3986b 100644 --- a/src/components/tabs/tab.tsx +++ b/src/components/tabs/tab.tsx @@ -156,7 +156,10 @@ export function Tab({ tab, active, ...restEvents }: ITabComponent) { tabItemClassName, status ? 'status' : 'op' )} - onClick={() => onCloseTab?.(id)} + onClick={(e) => { + e.stopPropagation(); + onCloseTab?.(id); + }} renderStatus={(isHover) => renderStatus(status, isHover)} /> )} diff --git a/src/components/tabs/tabExtra.tsx b/src/components/tabs/tabExtra.tsx index a9f7ac546..bdf5e69d2 100644 --- a/src/components/tabs/tabExtra.tsx +++ b/src/components/tabs/tabExtra.tsx @@ -3,7 +3,7 @@ import { getBEMElement } from 'mo/common/className'; interface ITabExtraProps { classNames?: string; - onClick?: () => void; + onClick?: React.MouseEventHandler; renderStatus?: (hover: boolean) => JSX.Element; } diff --git a/src/controller/panel.tsx b/src/controller/panel.tsx index 9717a09a1..de004b49f 100644 --- a/src/controller/panel.tsx +++ b/src/controller/panel.tsx @@ -66,11 +66,8 @@ export class PanelController extends Controller implements IPanelController { } public readonly onTabChange = (key: UniqueId): void => { - const state = this.panelService.getState(); if (key) { - this.panelService.setState({ - current: state.data?.find((item) => item.id === key), - }); + this.panelService.setActive(key); } this.emit(PanelEvent.onTabChange, key); };