Commit ceb9aa69 authored by 李硕's avatar 李硕

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

parent 2000cfcf
...@@ -114,21 +114,19 @@ Component({ ...@@ -114,21 +114,19 @@ Component({
}, },
changeCheckStatus(e) { changeCheckStatus(e) {
const { chooseId } = this.data; const { chooseId } = this.data;
if (chooseId.length >= 20) {
my.showToast({
type: "fail",
content: "最多选择20个宝贝",
});
return;
}
const { item } = e.target.dataset; const { item } = e.target.dataset;
if (chooseId.includes(item.itemId)) { if (chooseId.includes(item.itemId)) {
this.setData({ this.setData({
chooseId: chooseId.filter(v => v !== item.itemId), chooseId: chooseId.filter(v => v !== item.itemId),
}); });
} else { } else {
if (chooseId.length >= 20) {
my.showToast({
type: "fail",
content: "最多选择20个宝贝",
});
return;
}
this.setData({ this.setData({
chooseId: [...chooseId, item.itemId], 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