gemercheung 1 éve
szülő
commit
2d97c3c2a5
3 módosított fájl, 14 hozzáadás és 4 törlés
  1. 5 1
      src/components/imgLoading.vue
  2. 5 1
      src/pages/section1.vue
  3. 4 2
      src/utils/canvasPlayer.js

+ 5 - 1
src/components/imgLoading.vue

@@ -39,8 +39,12 @@ const framePro = ref(0);
 const imgPro = ref(0);
 
 watchEffect(() => {
-  if (fullpage.value && progress.value == 100) {
+  if (fullpage.value) {
     // fullpage.value.api.setAllowScrolling(true);
+    if (isMobile()) {
+      console.log("fitToSection2");
+      fullpage.value.api.fitToSection();
+    }
   }
 });
 emitter.on("updatePress", (val) => {

+ 5 - 1
src/pages/section1.vue

@@ -49,12 +49,16 @@ const process = ref(0);
 
 onMounted(() => {
   if (isMobile()) {
-    // var vcon = new window.VConsole();
+    var vcon = new window.VConsole();
   }
   emitter.on("onLeave", handler);
 
   emitter.on("loaded", () => {
     const player = usePlayer();
+    if (isMobile()) {
+      console.log("fitToSection1");
+      fullpage.value.api.fitToSection();
+    }
     setTimeout(() => {
       isShowCanvas.value = true;
       fullpage.value.api.setAllowScrolling(false);

+ 4 - 2
src/utils/canvasPlayer.js

@@ -37,6 +37,7 @@ export class CanvasPlayer extends Mitt {
     this.isScrollDoneTimeClip = isMobile() ? 10 : 40;
     this.resize = this.resize.bind(this);
     this.watchScroll = this.watchScroll.bind(this);
+    this.loadFrame = 0;
   }
   mount() {
     this.proload();
@@ -124,11 +125,12 @@ export class CanvasPlayer extends Mitt {
               const prev_base = Array.from(
                 this.setting.slice(0, framekey)
               ).reduce((pre, current) => pre + current["total"], 0);
+              this.loadFrame += 1;
 
-              const cu = key + prev_base;
+              const cu = this.loadFrame + prev_base;
 
               const process = Math.floor(Number(cu / total) * 100);
-
+              // console.log("process", process);
               this.emit("loadPress", process);
             }
           });