多选按钮
This commit is contained in:
parent
3024e8be90
commit
ce2539f983
@ -15,7 +15,7 @@
|
||||
|
||||
<!-- 底部结算栏 -->
|
||||
<view class="bottom">
|
||||
<radio :checked="true" color="#E03440" class="select_btn" />
|
||||
<radio :checked="selectAll" color="#E03440" class="select_btn" />
|
||||
<text class="select_text">全选</text>
|
||||
<text class="total_text">合计:</text>
|
||||
<text class="price">3999</text>
|
||||
@ -28,12 +28,14 @@
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
cartList: []
|
||||
cartList: [],
|
||||
selectAll: false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
const cartList = uni.getStorageSync("cartList") || [];
|
||||
this.cartList = cartList
|
||||
this.selectAll = this.cartList.every(item=>item.goods_select === true)
|
||||
},
|
||||
methods: {
|
||||
// 商品选择按钮切换
|
||||
@ -42,6 +44,9 @@ export default {
|
||||
// this.cartList[index].goods_select = !this.cartList[index].goods_select
|
||||
const index = this.cartList.findIndex(item=>item.goods_id === goods_id)
|
||||
this.cartList[index].goods_select = !this.cartList[index].goods_select
|
||||
|
||||
// 判断全选
|
||||
this.selectAll = this.cartList.every(item=>item.goods_select === true)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user