changed show logic
This commit is contained in:
@@ -26,27 +26,21 @@ const emit = defineEmits<Emits>();
|
||||
|
||||
// computed
|
||||
|
||||
const isShow = ref(modelValue.value);
|
||||
|
||||
watch(
|
||||
() => isShow.value,
|
||||
(nv) => {
|
||||
if (!nv) {
|
||||
emit("update:modelValue", false);
|
||||
const isShow = computed({
|
||||
get: () => modelValue.value ?? false,
|
||||
set: (value) => {
|
||||
emit("update:modelValue", value);
|
||||
if (!value) {
|
||||
emit("close", null);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DialogRoot
|
||||
v-model:open="isShow"
|
||||
@update:open="
|
||||
(state) => {
|
||||
!state ? (isShow = false) : null;
|
||||
}
|
||||
"
|
||||
@update:open="(state) => (isShow = state)"
|
||||
>
|
||||
<DialogTrigger :class="!$slots['trigger'] ? 'hidden' : ''">
|
||||
<slot name="trigger" />
|
||||
|
||||
Reference in New Issue
Block a user