为什么render()挂载的dom元素被删除后,无法再次挂载 !! Why can't render() mount a dom element again after it is deleted #10070
Unanswered
wilburfs
asked this question in
Help/Questions
Replies: 1 comment 1 reply
-
You are not supposed to manipulate DOM elements which are rendered by Vue. Use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
refer to this code :
import renderTest from './components/renderTest.vue'
const renderBtn = () => {
const test = document.querySelector('.test')
test != null && test.remove()
render(h(renderTest), document.body)
count.value+=1
}
const info=ref('激活')
const count=ref(0)
I binded this function on a btn.
the first time ,the component can be shown and removed. And then the render function no longer valid!!
[我把模板引入绑定在按钮上激活,第一次可以挂载,删除。之后,被引入的模板就无法再挂载了。demo在这里: [(https://github.com/wilburfs/vue3-render-issue.git )]
Beta Was this translation helpful? Give feedback.
All reactions