Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal组件 v-model:visible初始值为false也会进行预渲染,而不是等第一次值为true的时候才进行 #7213

Closed
1 task
peigoz opened this issue Dec 20, 2023 · 2 comments

Comments

@peigoz
Copy link

peigoz commented Dec 20, 2023

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

Version

3.2.20

Environment

vue3

Reproduction link

http://xx

Steps to reproduce

将Modal组件 v-model:visible初始值为false也会进行预渲染,而不是等第一次值为true的时候才进行

What is expected?

当我在通过函数调用将visible值改为true的时候再进行渲染,否则获取props的值不正确

What is actually happening?

将Modal组件 v-model:visible初始值为false也会进行预渲染,此时props为undefined


父组件传递props给modal作为初始值,因为modal会直接进行渲染,即setup函数会直接执行,const initData = ref(props.boolean),此时父组件的props值会为undefined

@cc-hearts
Copy link
Contributor

visible 控制的是显示,控制渲染时机可以使用 v-if="visible"

@aibayanyu20 aibayanyu20 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@peigoz
Copy link
Author

peigoz commented Dec 22, 2023

visible 控制的是显示,控制渲染时机可以使用 v-if="visible"

你的意思是我需要 <a-modal v-model:visible="open" v-if="open"/> 吗?可是这样v-model:visible这个属性就很怪,我明明不需要它,但是又不加不行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants