Browse Source

图片显示优化

shish 5 năm trước cách đây
mục cha
commit
92a138bae8
1 tập tin đã thay đổi với 13 bổ sung5 xóa
  1. 13 5
      ghsApp/src/components/app-uploader.vue

+ 13 - 5
ghsApp/src/components/app-uploader.vue

@@ -18,14 +18,14 @@
             <view class="iconfont icondelete" @click="delImg(index)"></view>
             <img
               :src="item"
-              @click="viewImg(item)"
+              @click="viewImg(index)"
               :style="{ width: size + 'rpx', height: size + 'rpx' }"
               :mode="imgMode"
               v-if="!prefixShow"
             />
             <img
               :src="`${constant.imgUrl}/${item}`"
-              @click="viewImg(item)"
+              @click="viewImg(index)"
               :style="{ width: size + 'rpx', height: size + 'rpx' }"
               :mode="imgMode"
               v-if="prefixShow"
@@ -419,10 +419,18 @@ export default {
       await this.postMsg();
     },
     // 预览
-    viewImg(path) {
+    viewImg(index) {
+			let previewImg = this.showImgList.map(item => {
+				  if(this.prefixShow == true){
+            return this.$constant.imgUrl+'/'+item
+          }else{
+            return item;
+          }
+			});
+      console.log('previewImg',previewImg,index)
       uni.previewImage({
-        urls: this.showImgList,
-        current: path
+        urls: previewImg,
+        current: index
       });
     },
     // 获取图片信息