码迷,mamicode.com
首页 > 其他好文 > 详细

点击的按钮为必选状态

时间:2019-12-30 11:25:06      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:点击   sel   iss   list   tree   按钮   none   提示   lse   

let total_selected = 0
//点击购物车确定按钮 判断用户选中的数量(必须手动勾选)
that.data.sku.tree.forEach(item => {
item.v.forEach(item => {
console.log(item)
if (item.isSelect == ‘true‘) {
total_selected += 1
}
})
})
// 是否 等于数组的长度 如果不等于就提示 阻止用户确定
if (total_selected != that.data.sku.tree.length) {
wx.showToast({
title: ‘请选择规格‘
})
return
}
if (that.data.sku.tree.length == 0) {
that.data.skuId = that.data.sku.list[0].id;
} else {
if (that.data.skuId == ‘‘) {
wx.showToast({
title: ‘请选择规格!‘,
icon: ‘none‘,
})
return;
}
}

点击的按钮为必选状态

标签:点击   sel   iss   list   tree   按钮   none   提示   lse   

原文地址:https://www.cnblogs.com/xiaoxiaoxun/p/12118402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!