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

Modal 弹窗内部组件直接使用v-if热更新失效

Open rylwl opened this issue 3 weeks ago • 2 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.6

Environment

Windows 11,Edge(chromium142),vue3.5

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Modal内写一个自定义组件,直接在自定义组件上使用v-if,然后在自定义组件内修改msg,保存

What is expected?

页面上热更新显示最新修改的msg

What is actually happening?

页面无反应,热更新不生效


我尝试过,如果用div包一层,把v-if放在div上就是正常的;我还怀疑过是不是teleport导致的,后面尝试自己teleport一个div到外面测试,发现也是正常的

rylwl avatar Nov 24 '25 11:11 rylwl

研究了一下,发现好像是components\vc-dialog\Content.tsx里面使用了Transition组件导致的,我测试发现如果把Transition组件移除好像就可以正常热更新了

rylwl avatar Nov 27 '25 16:11 rylwl

将查看问题

webvs2 avatar Dec 09 '25 05:12 webvs2

研究了一下,发现好像是components\vc-dialog\Content.tsx里面使用了Transition组件导致的,我测试发现如果把Transition组件移除好像就可以正常热更新了

我查看了,只要是组件引入在其上加入if,就会失去热更新响应,天啊,好奇怪的问题

webvs2 avatar Dec 11 '25 05:12 webvs2