Skip to content

Commit

Permalink
fix: fix panels didn't active the next one after closing automatically (
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung authored Feb 13, 2022
1 parent 2294b3d commit 784dc07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/components/tabs/tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tabs/tabExtra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getBEMElement } from 'mo/common/className';

interface ITabExtraProps {
classNames?: string;
onClick?: () => void;
onClick?: React.MouseEventHandler<HTMLDivElement>;
renderStatus?: (hover: boolean) => JSX.Element;
}

Expand Down
5 changes: 1 addition & 4 deletions src/controller/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 784dc07

Please sign in to comment.