materio-d9/web/themes/custom/materiotheme/vuejs/components/Content/Home.vue

36 lines
812 B
Vue
Raw Normal View History

<script>
import Vue from 'vue'
export default {
props: ['html'], // get the html from parent with props
data() {
return {
template: null // compiled template from html used in render
}
},
beforeMount() {
// console.log('Home beforeMount');
// compile the html src (coming from parent with props or from ajax call)
if(this.html){
// console.log('html', this.html);
this.template = Vue.compile(this.html)
this.$options.staticRenderFns = []
this._staticTrees = []
this.template.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)))
}
},
render(h) {
if(!this.template){
return h('span', 'Loading ...')
}else{
return this.template.render.call(this)
}
}
}
</script>
<style lang="scss" scoped>
</style>