张延森 2 years ago
parent
commit
8db479b71d
2 changed files with 8 additions and 2 deletions
  1. 3
    2
      src/App.vue
  2. 5
    0
      src/components/Mask.vue

+ 3
- 2
src/App.vue View File

@@ -24,8 +24,9 @@ onMounted(() => {
24 24
 <template>
25 25
   <Loader :loading="loading" :percent="percent" />
26 26
   <ScrollDown />
27
-  <Image v-for="(res, inx) in resources" :key="res.image" :resource="res"></Image>
27
+  <Image v-for="res in resources" :key="res.image" :resource="res"></Image>
28 28
 </template>
29 29
 
30
-<style scoped>
30
+<style lang="less" scoped>
31
+
31 32
 </style>

+ 5
- 0
src/components/Mask.vue View File

@@ -22,6 +22,11 @@
22 22
   img.src = indexImage;
23 23
   img.onload = function() {
24 24
     const canv = cvsRef.value;
25
+
26
+    const { clientWidth, clientHeight } = document.body;
27
+    canv.style.width = `${clientWidth}px`;
28
+    canv.style.height = `${img.naturalHeight * clientWidth / img.naturalWidth}px`;
29
+
25 30
     canv.width = img.naturalWidth;
26 31
     canv.height = img.naturalHeight;
27 32
   }