0
I need to insert a compiled element into DOM
, but it will be inserted in a random place, not in a predefined place as this documentation...
var res = Vue.compile('<div><span>{{ msg }}</span></div>')
new Vue({
data: {
msg: 'hello'
},
render: res.render,
staticRenderFns: res.staticRenderFns
})
All approaches with v-for
, v-if/show
will not serve me because they also need predefined elements.
I tried something like this...
document.getElementById('elPai').insertAdjacentHTML('beforeend', Vue.compile('<div><span>{{ msg }}</span></div>'));
It returns an object containing render
and staticRenderFns
, but I didn’t find the compiled result in these objects, it seems to me that he is recorded in a promisse
, which is triggered when the element is predefined in the FOD.
Finally, it is possible to insert elements compiled in the DOM with vue 2
?