Commit ceb9aa69 authored by 李硕's avatar 李硕

选择宝贝为20个时无法取消

parent 2000cfcf
......@@ -114,21 +114,19 @@ Component({
},
changeCheckStatus(e) {
const { chooseId } = this.data;
if (chooseId.length >= 20) {
my.showToast({
type: "fail",
content: "最多选择20个宝贝",
});
return;
}
const { item } = e.target.dataset;
if (chooseId.includes(item.itemId)) {
this.setData({
chooseId: chooseId.filter(v => v !== item.itemId),
});
} else {
if (chooseId.length >= 20) {
my.showToast({
type: "fail",
content: "最多选择20个宝贝",
});
return;
}
this.setData({
chooseId: [...chooseId, item.itemId],
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment