修复 button disabled 状态下 click 仍然触发的问题

This commit is contained in:
就眠儀式
2022-01-14 11:38:57 +08:00
parent 683ca7c267
commit a1f8afc4b5
2 changed files with 15 additions and 1 deletions

View File

@@ -27,6 +27,14 @@ const props = withDefaults(defineProps<LayButtonProps>(), {
nativeType: "button",
});
const emit = defineEmits(["click"]);
const onClick = (event : any) => {
if(!props.disabled) {
emit("click", event);
}
}
const classes = computed(() => {
return [
props.type ? `layui-btn-${props.type}` : "",
@@ -48,6 +56,7 @@ const classes = computed(() => {
classes,
]"
:type="nativeType"
@click="onClick"
>
<i
v-if="loading"