perf(SidebarItem): move onClick fn

This commit is contained in:
chenjiahan 2020-08-26 13:22:35 +08:00
parent f9226cdfac
commit e045fb1596

View File

@ -21,12 +21,8 @@ export default createComponent({
const route = useRoute();
const { parent, index } = useParent(SIDEBAR_KEY);
return () => {
const { dot, badge, title, disabled } = props;
const selected = index.value === parent.active();
const onClick = () => {
if (disabled) {
if (props.disabled) {
return;
}
@ -36,6 +32,10 @@ export default createComponent({
route();
};
return () => {
const { dot, badge, title, disabled } = props;
const selected = index.value === parent.active();
return (
<a class={bem({ select: selected, disabled })} onClick={onClick}>
<div class={bem('text')}>