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