李志伟 3 lat temu
rodzic
commit
630ec85182
1 zmienionych plików z 14 dodań i 32 usunięć
  1. 14
    32
      src/components/imgbox.vue

+ 14
- 32
src/components/imgbox.vue Wyświetl plik

@@ -1,14 +1,11 @@
1 1
 <template>
2
-  <div :class="{ bigBox: state === 1 }">
3
-    <popup :show="showPopup" @cancel="cancelFrom" />
4
-    <div class="card" :class="{ flipped: state === 1 }" @click="showPopup=true">
2
+  <div class="bigBox">
3
+    <div class="card" :class="{ flipped: mode === 2 }">
5 4
       <div class="front">
6
-        <img v-if="isFrist" :src="fristFontImg" class="nowimage" />
7
-        <img v-else :src="nowFontImg" class="nowimage" />
5
+        <img :src="poster" class="nowimage" />
8 6
       </div>
9 7
       <div class="back">
10
-        <img v-if="state===1" :src="nowBackImg" class="nowimage" />
11
-        <img v-else :src="openImg" class="nowimage" />
8
+        <img :src="nowBackImg" class="nowimage" />
12 9
       </div>
13 10
     </div>
14 11
   </div>
@@ -16,13 +13,14 @@
16 13
 <script>
17 14
 export default {
18 15
   props: {
19
-    value: {
20
-      type: String,
21
-      require: true,
16
+    prize: {
17
+      type: Object,
18
+      default: () => ({})
22 19
     },
23
-  },
24
-  components: {
25
-    Popup: () => import("@/components/Popup.vue"),
20
+    mode: {
21
+      type: String,
22
+      default: '1'
23
+    }
26 24
   },
27 25
   data() {
28 26
     return {
@@ -36,25 +34,9 @@ export default {
36 34
       isFrist:true,
37 35
     };
38 36
   },
39
-  watch: {
40
-    value: {
41
-      handler(val) {
42
-        if (val) {
43
-          this.fristFontImg = val;
44
-        }
45
-      },
46
-      immediate: true,
47
-    },
48
-  },
49
-  methods: {
50
-    transform() {
51
-      this.showPopup=true
52
-      this.state = Math.abs(this.state - 1);
53
-    },
54
-    cancelFrom() {
55
-      this.state = Math.abs(this.state - 1);
56
-      this.showPopup=false
57
-      this.isFrist=false
37
+  computed: {
38
+    poster() {
39
+      return this.mode === 1 ? this.nowFontImg : '';
58 40
     }
59 41
   },
60 42
 };