refactor(ActionBarIcon): extract onClick logic to setup (#13762)
This commit is contained in:
@@ -66,26 +66,22 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return () => {
|
const onClick = () => {
|
||||||
const { disabled } = props;
|
if (!props.disabled) {
|
||||||
|
route();
|
||||||
const handleClick = () => {
|
}
|
||||||
if (!disabled) {
|
|
||||||
route();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
role="button"
|
|
||||||
class={bem({ disabled })}
|
|
||||||
tabindex={disabled ? -1 : 0}
|
|
||||||
onClick={handleClick}
|
|
||||||
>
|
|
||||||
{renderIcon()}
|
|
||||||
{slots.default ? slots.default() : props.text}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<div
|
||||||
|
role="button"
|
||||||
|
class={bem({ disabled: props.disabled })}
|
||||||
|
tabindex={props.disabled ? -1 : 0}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{renderIcon()}
|
||||||
|
{slots.default ? slots.default() : props.text}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user