소스 검색

home async loading bug fix

Bachir Soussi Chiadmi 3 년 전
부모
커밋
c4a803cbd9
2개의 변경된 파일15개의 추가작업 그리고 32개의 파일을 삭제
  1. 0 27
      web/themes/custom/materiotheme/assets/dist/main.js
  2. 15 5
      web/themes/custom/materiotheme/vuejs/components/Pages/Home.vue

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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()
+    }
   }
 }
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.