Skip to content

Commit 4341e91

Browse files
committed
fix(modal): add onUpdate:open prop
1 parent 6c13c96 commit 4341e91

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: components/modal/Modal.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export const modalProps = () => ({
5151
onOk: Function as PropType<(e: MouseEvent) => void>,
5252
onCancel: Function as PropType<(e: MouseEvent) => void>,
5353
'onUpdate:visible': Function as PropType<(visible: boolean) => void>,
54-
onChange: Function as PropType<(visible: boolean) => void>,
54+
'onUpdate:open': Function as PropType<(open: boolean) => void>,
55+
onChange: Function as PropType<(open: boolean) => void>,
5556
afterClose: Function as PropType<() => void>,
5657
centered: { type: Boolean, default: undefined },
5758
width: [String, Number],
@@ -179,6 +180,7 @@ export default defineComponent({
179180
};
180181

181182
const handleOk = (e: MouseEvent) => {
183+
emit('update:open', false);
182184
emit('ok', e);
183185
};
184186

Diff for: components/modal/demo/basic.vue

-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@ const showModal = () => {
3636
3737
const handleOk = (e: MouseEvent) => {
3838
console.log(e);
39-
open.value = false;
4039
};
4140
</script>

0 commit comments

Comments
 (0)