refactor(ActionBarIcon): extract onClick logic to setup (#13762)
This commit is contained in:
@@ -66,26 +66,22 @@ export default defineComponent({
|
||||
);
|
||||
};
|
||||
|
||||
return () => {
|
||||
const { disabled } = props;
|
||||
|
||||
const handleClick = () => {
|
||||
if (!disabled) {
|
||||
const onClick = () => {
|
||||
if (!props.disabled) {
|
||||
route();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
return () => (
|
||||
<div
|
||||
role="button"
|
||||
class={bem({ disabled })}
|
||||
tabindex={disabled ? -1 : 0}
|
||||
onClick={handleClick}
|
||||
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