Liuteng пре 2 месеци
родитељ
комит
3633291ccf
1 измењених фајлова са 17 додато и 4 уклоњено
  1. 17 4
      src/App.vue

+ 17 - 4
src/App.vue

@@ -11,14 +11,27 @@ export default {
   data() {
     return {
       zoom: 1,
+      count: 0,
     };
   },
 
   mounted() {
-    setTimeout(() => {
-      const dpi = this.$route.query.dpi || 1920;
-      this.zoom = dpi / 1920;
-    }, 3000);
+    this.setDpi();
+  },
+
+  methods: {
+    setDpi() {
+      if (this.count < 5) {
+        setTimeout(() => {
+          const dpi = this.$route.query.dpi || 1920;
+          this.$nextTick(() => {
+            this.zoom = dpi / 1920;
+          });
+          this.count = this.count + 1;
+          this.setDpi();
+        }, this.count * 2000);
+      }
+    },
   },
 };
 </script>