UNIAPP----批量删除海报等

 基于uview的瀑布流,然后自己加了个checbox点击。

每次点击,先判断需要删除的id在不在数组里面,如果indexof没有返回值,则push,如果是-1,则splice去除。

<view class="wrap u-m-b-40">
			<u-waterfall v-model="posterList" ref="uWaterfall">
				<template v-slot:left="{ leftList }">
					<view class="demo-warter" v-for="(item, index) in leftList" :key="index">
						<view v-show="check_show" style="width: 20px;height:20px;position: absolute;z-index: 2;right: 10px;">
							<u-checkbox shape="circle" size="40" active-color="#0055ff" v-model="check1" @change="che1(item)"></u-checkbox>
						</view>
						<u-lazy-load @click="goDetail(item)" threshold="-450" border-radius="10" :image="item.img" :index="index"></u-lazy-load>
						<view class="demo-title f-12 f-black u-p-t-10">{{ item.title }}</view>
						<view class="demo-tag  wllw-flex wllw-flex-between">
							<view class="demo-tag-text f-12 f-c-9">{{ item.share_num }}人分享过</view>
							<view class="demo-tag-text"><u-icon name="zhuanfa" :color="$common.icon.colorSix" size="28"></u-icon></view>
						</view>
					</view>
				</template>
				<template v-slot:right="{ rightList }">
					<view class="demo-warter" v-for="(item, index) in rightList" :key="index">
						<view v-show="check_show" style="width: 20px;height:20px;position: absolute;z-index: 2;right: 10px;">
							<u-checkbox shape="circle" size="40" active-color="#0055ff" v-model="check2" @change="che2(item)"></u-checkbox>
						</view>
						<u-lazy-load @click="goDetail(item)" threshold="-450" border-radius="10" :image="item.img" :index="index"></u-lazy-load>
						<view class="demo-title f-12 f-black u-p-t-10">{{ item.title }}</view>
						<view class="demo-tag  wllw-flex wllw-flex-between">
							<view class="demo-tag-text f-12 f-c-9">{{ item.share_num }}人分享过</view>
							<view class="demo-tag-text"><u-icon name="zhuanfa" :color="$common.icon.colorSix" size="28"></u-icon></view>
						</view>
					</view>
				</template>
			</u-waterfall>
		</view>
check1: false,
check2: false,
posterList: [],
che1(item) {
			console.log(item);
			this.check1 = true;
			var num = this.ids.indexOf(item.id);

			if (num > -1) {
				this.ids.splice(num, 1);
			} else {
				this.ids.push(item.id);
			}
			console.log(this.ids)
		},
		che2(item) {
			this.check2 = true;
			var num = this.ids.indexOf(item.id);
			
			if (num > -1) {
				this.ids.splice(num, 1);
			} else {
				this.ids.push(item.id);
			}
			console.log(this.ids)
		},
		del() {
			this.check_show = true;			
		},
		cancel() {
			this.check_show = false;
			this.ids = []
			this.check1 = false;
			this.check2 = false;
		},
		add(){
			console.log(this.ids)
			model.getDel_poster(this,this.ids)
			model.getPoster(this, this.poster_params);
		}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值