Skip to content

Click the a-modal cross to report an error, and the popup cannot be closed  #3761

@xianyulli

Description

@xianyulli
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.1

Environment

vue3.0.1

Reproduction link

http://xxx.com

Steps to reproduce

1.父级组件通过

2.子组件
<a-modal
v-model:visible="visible"
centered
destroyOnClose
:title="modalTitle"
@cancel='handleCancel1'
@ok="handleOk">

Some contents...

Some contents...

Some contents...

返回 确认

3.// 实现代码
setup(props, context) {
/** 加载中 */
const loading = ref(false);

const handleOk = (e: MouseEvent) => {
close();
};
const handleCancel1 =() => {
close();
}
const close = () => {
context.emit('update:visible', false);
}
const modalTitle = computed(() => {
return titleMap.get(props.mode);
});
return {
loading,
handleOk,
modalTitle,
handleCancel1
};
},
点击取消按钮可以关闭,点击叉叉报错:
Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'visible'
at _createBlock.onUpdate:visible._cache.._cache. (Edit.vue:4)
at callWithErrorHandling (runtime-core.esm-bundler.js:154)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:163)
at emit (runtime-core.esm-bundler.js:642)
at Proxy.handleCancel (Modal.js:145)
at Proxy.__emit (BaseMixin.js:57)
at Proxy.close4 (Dialog.js:482)
at callWithErrorHandling (runtime-core.esm-bundler.js:154)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:163)
at HTMLButtonElement.invoker (runtime-dom.esm-bundler.js:308)
我这里怀疑是cancel回调的执行时机太早

What is expected?

点击可以直接关闭

What is actually happening?

不能关闭并报错

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions