Browse Source

add booklist preview image & stop bubbling

charblus 5 years ago
parent
commit
15d25db175
1 changed files with 14 additions and 1 deletions
  1. 14 1
      src/components/Card.vue

+ 14 - 1
src/components/Card.vue

@@ -2,7 +2,12 @@
   <a :href="detailUrl">
     <div class="book-card">
       <div class="thumb">
-        <img :src="book.image" class="img" mode="aspectFit">
+        <img 
+          :src="book.image" 
+          class="img" 
+          mode="aspectFit"
+          @click.stop="preview"
+          >
       </div>
       <div class="detail">
         <div class="row text-primary">
@@ -45,6 +50,14 @@ export default {
     detailUrl() {
       return '/pages/detail/main?id='+ this.book.id
     }
+  },
+  methods: {
+    preview() {
+      wx.previewImage({
+        current: this.book.image,
+        urls: [this.book.image]
+      })
+    }
   }
 
 }