18910140161

V-if 组件不渲染dom节点

顺晟科技

2021-06-19 08:09:07

284

子组件是tool,如果不加v-if就正常,加了v-if后可以执行子组件钩子函数,但是找不到dom节点,请问如何解决,谢谢


顺晟科技:

v-show is like setting CSS display to none. So the DOM still exists, but you can’t see it.v-if is like using javascript to set element to remove from tree that you specified.

因為你給的資訊太少了 不過如果是async的問題 可以用這種方式解掉 不一定要註冊在tool上面

tool组件没写dom元素

If you want the DOM still exists, using v-show.

thanks for reply,but in my project,i need to use “v-if”,because i have to prepare the data which used by the “tool” component in an async function,if i use v-show to render the “tool” component,it would cause complex problem

相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航