but it should be on the element
Yes, but if v-if conditional value is false, it is not added to the DOM tree.
HTML
<div id="main"></div>
Javascript
new Vue({ el: "#main", template: '<div v-if="name"><span v-text="name"></span></div>', data: { // name: "bob" } }); console.log(document.body.innerHTML); // <div id="main"></div>
Still not good for you?
source share