I need to show components that are passed through props and output them through v-html. I found a render solution. But I can't figure out how to apply this in a local component, because I'm using nuxt. Vue.compile(this.vcontent); give an error
<script>
export default {
props: ['vcontent'],
data() {
return {
templateRender: null,
}
},
render(h) {
if (!this.templateRender) {
return h('div', 'loading...');
} else { // If there is a template, I'll show it
return this.templateRender();
}
},
watch: {
vcontent:{
immediate: true, // makes the watcher fire on first render, too.
handler() {
var res = Vue.compile(this.vcontent);
this.templateRender = res.render;
// staticRenderFns belong into $options,
// appearantly
this.$options.staticRenderFns = []
// clean the cache of static elements
// this is a cache with the results from the staticRenderFns
this._staticTrees = []
// Fill it with the new staticRenderFns
for (var i in res.staticRenderFns) {
//staticRenderFns.push(res.staticRenderFns[i]);
this.$options.staticRenderFns.push(res.staticRenderFns[i])
}
}
}
},
}
</script>
if im trying to import Vue in component, webpack gives an error vue__WEBPACK_IMPORTED_MODULE_0___default.a.compile is not a function

