ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

The destroyOnClose property of the modal box modal is invalid

Open ArealRJ opened this issue 3 years ago • 1 comments
trafficstars

  • [ ] 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内的子元素并没有被销毁

ArealRJ avatar Sep 07 '22 08:09 ArealRJ

升级 3.x,或者自行加 key 来处理

tangjinzhou avatar Sep 13 '22 13:09 tangjinzhou

升级 3.x,或者自行加 key 来处理

请问加 key 具体是在哪里加呢? a-modal?尝试了一下加了一个根据弹窗显隐动态变化的 key 的无效。

Linhongbin-1111 avatar Sep 26 '22 08:09 Linhongbin-1111

首先关闭是否清空表单值和 modal 没关系,你可以监听 visible 变化,手动清空form 值, 然后,如果你想关闭的时候销毁 modal,使用 v-if="visible" 也可以实现

tangjinzhou avatar Sep 27 '22 02:09 tangjinzhou

首先关闭是否清空表单值和 modal 没关系,你可以监听 visible 变化,手动清空form 值, 然后,如果你想关闭的时候销毁 modal,使用 v-if="visible" 也可以实现

这个问题在1.x也有,现在相当于 destroyOnClose 属性是不起作用的,而在3.x是起作用的。然后,如果使用 v-if="visible"就是销毁整个modal了,关闭动画也会丢失

ILfengzi avatar Sep 27 '22 06:09 ILfengzi

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

github-actions[bot] avatar Nov 27 '22 02:11 github-actions[bot]

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: @.***>

ArealRJ avatar Nov 27 '22 06:11 ArealRJ

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

github-actions[bot] avatar Jan 28 '23 02:01 github-actions[bot]

已收到!

ILfengzi avatar Jan 28 '23 02:01 ILfengzi

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

github-actions[bot] avatar Mar 31 '23 02:03 github-actions[bot]