fix(button): btn disable

This commit is contained in:
Zephyruso 2023-09-08 10:18:48 +08:00
parent 654a07fa9d
commit 59a7273665

View File

@ -11,12 +11,20 @@ export const Button: ParentComponent<
return (
<button
class={twMerge(
'btn',
local.disabled && 'btn-disabled',
local.loading ? 'btn-disabled' : local.class,
)}
class={twMerge('btn', local.loading ? 'btn-disabled' : local.class)}
{...others}
onClick={(e) => {
if (props.disabled) {
e.preventDefault()
e.stopPropagation()
return
}
if (typeof props.onClick === 'function') {
props.onClick(e)
}
}}
>
<Show when={local.loading}>
<span class="loading loading-spinner" />