Pārlūkot izejas kodu

海报选择图片BUG

xiansin 4 gadi atpakaļ
vecāks
revīzija
bbbb93e688
1 mainītis faili ar 28 papildinājumiem un 13 dzēšanām
  1. 28 13
      pages/poster/goods.vue

+ 28 - 13
pages/poster/goods.vue

xqd xqd xqd
@@ -45,13 +45,26 @@
                             <icon :class="getTheme + '-m-back ' + getTheme"></icon>
                             <text>选择图片(最多{{chooseImagesLen}}张)</text>
                         </view>
-                        <view class="dir-left-wrap box-grow-1 images-group">
+                        <view class="dir-left-wrap box-grow-1">
+                            <scroll-view scroll-x class="images-group" enable-flex="true">
                                 <image v-for="(item,key) in info.multi_map" :key="key"
-                                        mode="aspectFill"
-                                        :src="item" @click.stop="selectImages(key)"
-                                        :class="chooseImages.indexOf(key)!=-1?'active '+ getTheme + '-m-border':''">
+                                       mode="aspectFill"
+                                       :src="item" @click.stop="selectImages(key)"
+                                       :class="chooseImages.indexOf(key)!=-1?'active '+ getTheme + '-m-border':''">
                                 </image>
+                            </scroll-view>
                         </view>
+
+                            <!--<view class="dir-left-wrap box-grow-1 images-group">
+                                <view v-for="(item,key) in info.multi_map" :key="key">
+                                    <image :src="item"></image>
+                                </view>
+                                &lt;!&ndash;<image v-for="(item,key) in info.multi_map" :key="key"
+                                       mode="aspectFill"
+                                       :src="item" @click.stop="selectImages(key)"
+                                       :class="chooseImages.indexOf(key)!=-1?'active '+ getTheme + '-m-border':''">
+                                </image>&ndash;&gt;
+                            </view>-->
                     </view>
                     <view class="dir-left-nowrap line" v-else>
                         <view class="box-grow-0 main-center cross-center label">
@@ -284,12 +297,11 @@
                 })
             },
             selectImages(index){
-				console.log(this.info.multi_map[index])
-                let findIndex = this.info.chooseImages.findIndex(item => {
+                let findIndex = this.chooseImages.indexOf(index);
+               /* let findIndex = this.info.chooseImages.findIndex(item => {
                     return item == this.info.multi_map[index]
-                });
-				console.log(findIndex)
-                if(findIndex > -1){
+                });*/
+                if(findIndex != -1){
                     if(this.info.chooseImages.length > 1){
                         this.chooseImages.splice(this.chooseImages.indexOf(index), 1)
                         this.info.chooseImages.splice(findIndex,1)
@@ -458,14 +470,17 @@
         }
         .choose-images{
             flex-direction: column;
-            align-items: start;
+            >view{
+                justify-content: start;
+            }
             .images-group{
                 padding: 0 24rpx;
+                width: 100%;
+                white-space: nowrap;
                 image{
-                    width: 120rpx;
+                    width: 150rpx;
                     height: 120rpx;
-                    margin-bottom: 20rpx;
-                    margin-right: 20rpx;
+                    margin-right: 10rpx;
                     filter: grayscale(1);
                     border: 1px solid #ddd;
                     &.active{