The following code will produce an empty comment node i.e. <!---->.
How to produce a non-empty comment node e.g. <!-- Foo --> using h?
export default {
render(h) {
return h(null)
},
}
The following code will produce an empty comment node i.e. <!---->.
How to produce a non-empty comment node e.g. <!-- Foo --> using h?
export default {
render(h) {
return h(null)
},
}
Copyright © 2021 Jogjafile Inc.
It seems Vue 2.6.14 no longer allows doing any of the following, but it's possible in Vue 3.
Option 1:
h(null)with string as second argumentNote: This generates a runtime warning about using
null:You could workaround that with
resolveDynamicComponent(null)instead ofnull:Option 2:
h(Comment)with string as second argumentOption 3:
createCommentVNode()with string as argumentNote:
createCommentVNodeis an internal API, which can be removed/renamed in a future release, so use it with caution.Vue 3 demo