翱翔的菜鸟
翱翔的菜鸟
  • 发布:2019-06-17 15:58
  • 更新:2019-06-17 16:05
  • 阅读:857

我自己写了个多选,然后小程序可以使用,app出现了问题

分类:uni-app
        <view :class="{pd:checkoff}">  
            <view class="info" v-for="(item,index) in infor" :key="index" @tap="check_box(item.id)" >  
                <view v-if="checkoff">  
                    <!-- <image class="check" :src="arr.indexOf(item.id)!=-1?xz:wxz"></image> -->  
                     <image class="check" src="../../static/user/xz.png" v-if="cz(item.id)"></image>  
                     <image class="check" src="../../static/user/wxz.png" v-else></image>  
                </view>  
                <view :class="[checkoff?'active':'notice']">  
                    <view class="info_top">  
                        <view class="info_title">  
                            <text>系统通知</text>  
                            <!-- <view class="info_circle"></view> -->  
                        </view>  
                        <view class="info_time">  
                            {{ item.creatTime.slice(0,10)==nowtime?item.creatTime.slice(-8): item.creatTime.slice(0,10)}}  
                        </view>  
                    </view>  
                    <view class="info_state">  
                        订单{{ item.orderno }}已{{ item.status==1?"完成交易":"取消交易" }}  
                    </view>  
                </view>  
            </view>  
        </view>  

        <view class="bottom" v-show="checkoff">  
            <view class="allElection" @tap="allElection">全选</view>  
            <view class="del" @tap="del">删除</view>  
        </view>  

    check_box: function(id) {  
                console.log(this.arr);  
                let a = this.arr.indexOf(id);  
                if (a != -1) {  
                    this.arr.splice(this.arr.indexOf(id), 1)  
                } else {  
                    this.arr.push(id);  
                }  
                this.cz(id);  
            },  
cz:function(id){  
                let a;  
                for(let i=0;i<this.arr.length;i++){  
                    if(this.arr[i]==id){  
                        a=true;  
                        break;  
                    }else{  
                        a=false;  
                    }  
                }  
                return a;  
            },  
2019-06-17 15:58 负责人:无 分享
已邀请:
翱翔的菜鸟

翱翔的菜鸟 (作者) - 90后

cz:function(id){  
                let a;  
                for(let i=0;i<this.arr.length;i++){  
                    if(this.arr[i]==id){  
                        a=true;  
                        break;  
                    }else{  
                        a=false;  
                    }  
                }  
                return a;  
            },  
    check_box: function(id) {  
                console.log(this.arr);  
                let a = this.arr.indexOf(id);  
                if (a != -1) {  
                    this.arr.splice(this.arr.indexOf(id), 1)  
                } else {  
                    this.arr.push(id);  
                }  
                this.cz(id);  
            },
颓废市民小高

颓废市民小高

:class="{pd:checkoff}" 好像不用加{}吧。。。

颓废市民小高

颓废市民小高

你@tap="check_box(item.id)" 这个写法要check_box: function(e) console.log(e); 不用加e.啥啥啥,
你也可以这样写:data-num="1" @tap="check_box" 要check_box: function(e) console.log(e.target.dataset.num);

该问题目前已经被锁定, 无法添加新回复