home async loading bug fix

This commit is contained in:
Bachir Soussi Chiadmi 2021-01-04 11:31:01 +01:00
parent 84ae91655e
commit c4a803cbd9
2 changed files with 16 additions and 46 deletions

File diff suppressed because one or more lines are too long

View File

@ -21,10 +21,7 @@ export default {
// compile the html src (coming from parent with props or from ajax call) // compile the html src (coming from parent with props or from ajax call)
if(this.html){ if(this.html){
// console.log('html', this.html); // console.log('html', this.html);
this.template = Vue.compile(this.html) this.compileTemplate()
this.$options.staticRenderFns = []
this._staticTrees = []
this.template.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)))
} }
}, },
render(h) { render(h) {
@ -35,9 +32,16 @@ export default {
} }
}, },
mounted(){ mounted(){
this.initShowroomCarroussel() // this.initShowroomCarroussel()
}, },
methods: { methods: {
compileTemplate(){
this.template = Vue.compile(this.html)
this.$options.staticRenderFns = []
this._staticTrees = []
this.template.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)))
setTimeout(this.initShowroomCarroussel.bind(this), 250)
},
initShowroomCarroussel(){ initShowroomCarroussel(){
console.log("startShowroomCarroussel"); console.log("startShowroomCarroussel");
this.showrooms = document.querySelectorAll('.field--name-computed-showrooms-reference > .field__item') this.showrooms = document.querySelectorAll('.field--name-computed-showrooms-reference > .field__item')
@ -131,6 +135,12 @@ export default {
}) })
} }
} }
},
watch: {
html: function(val) {
console.log('html prop changed', val)
this.compileTemplate()
}
} }
} }