ant-design-vue
ant-design-vue copied to clipboard
The destroyOnClose property of the modal box modal is invalid
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
Version
2.2.8
Environment
macos,edge104.0.1293.70,vue3.24
Reproduction link
https://2x.antdv.com/components/modal-cn#API
Steps to reproduce
<a-modal :width="300" :height="400" :visible="visible" :destroyOnClose="true" :closable="true" :confirmLoading="loading" :footer="null" @cancel="cancel" :data="data"
What is expected?
当关闭modal时,form表单的内容应该被清空
What is actually happening?
再次打开modal,上次输入的表单内容被保存了,modal内的子元素并没有被销毁
升级 3.x,或者自行加 key 来处理
升级 3.x,或者自行加 key 来处理
请问加 key 具体是在哪里加呢? a-modal?尝试了一下加了一个根据弹窗显隐动态变化的 key 的无效。
首先关闭是否清空表单值和 modal 没关系,你可以监听 visible 变化,手动清空form 值, 然后,如果你想关闭的时候销毁 modal,使用 v-if="visible" 也可以实现
首先关闭是否清空表单值和 modal 没关系,你可以监听 visible 变化,手动清空form 值, 然后,如果你想关闭的时候销毁 modal,使用 v-if="visible" 也可以实现
这个问题在1.x也有,现在相当于 destroyOnClose 属性是不起作用的,而在3.x是起作用的。然后,如果使用 v-if="visible"就是销毁整个modal了,关闭动画也会丢失
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
1
该邮件从移动设备发送
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年11月27日(星期天) 上午10:53 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [vueComponent/ant-design-vue] The destroyOnClose property of the modal box modal is invalid (Issue #5953)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days
已收到!
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days