1234567891011121314151617181920212223242526272829303132333435 |
- <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>
|