Browse Source

home async loading bug fix

Bachir Soussi Chiadmi 3 years ago
parent
commit
c4a803cbd9

File diff suppressed because it is too large
+ 0 - 27
web/themes/custom/materiotheme/assets/dist/main.js


+ 15 - 5
web/themes/custom/materiotheme/vuejs/components/Pages/Home.vue

@@ -21,10 +21,7 @@ export default {
     // 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)))
+      this.compileTemplate()
     }
   },
   render(h) {
@@ -35,9 +32,16 @@ export default {
     }
   },
   mounted(){
-    this.initShowroomCarroussel()
+    // this.initShowroomCarroussel()
   },
   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(){
       console.log("startShowroomCarroussel");
       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()
+    }
   }
 }
 

Some files were not shown because too many files changed in this diff