When using Vue.compile to handle async HTML, it appears that there is a limit of two elements deep before encountering an error. Rendering anything deeper than that results in
Error in render: "TypeError: Cannot read property '0' of undefined"
.
For example,
<section><p>hello</p><section>
works fine but <section><p>hello <em>there</em></p><section>
fails to render.
Check out the code example below and view the fiddle. (Asynchronously simulated by setTimeout)
new Vue({
el: '#app',
data: {
msg: 'simple template works',
template: Vue.compile('<p>{{msg}}</p>').render
},
render(createElement) {
return this.template();
},
mounted() {
// Note that the below snippet fails
setTimeout(()=>{
this.template = Vue.compile('<div><p>{{msg}}</p><p>Nesting more than three tags deep <em>fails</em>?</p></div>').render;
}, 1000);
// This one renders correctly
setTimeout(()=>{
this.template = Vue.compile('<div><p>{{msg}}</p><p>Nesting more than three tags deep fails?</p></div>').render;
}, 2000);
}
})
Does anyone know what might be causing this issue? Are 'complex' templates supposed to be compiled/rendered differently?