refactor(ActionBarIcon): extract onClick logic to setup (#13762)

This commit is contained in:
inottn
2026-02-18 14:12:06 +08:00
committed by GitHub
parent 4594c53f53
commit b1283de219

View File

@@ -66,26 +66,22 @@ export default defineComponent({
);
};
return () => {
const { disabled } = props;
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>
);
const onClick = () => {
if (!props.disabled) {
route();
}
};
return () => (
<div
role="button"
class={bem({ disabled: props.disabled })}
tabindex={props.disabled ? -1 : 0}
onClick={onClick}
>
{renderIcon()}
{slots.default ? slots.default() : props.text}
</div>
);
},
});