Commit ceb9aa69 authored by 李硕's avatar 李硕

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

parent 2000cfcf
...@@ -114,7 +114,12 @@ Component({ ...@@ -114,7 +114,12 @@ Component({
}, },
changeCheckStatus(e) { changeCheckStatus(e) {
const { chooseId } = this.data; const { chooseId } = this.data;
const { item } = e.target.dataset;
if (chooseId.includes(item.itemId)) {
this.setData({
chooseId: chooseId.filter(v => v !== item.itemId),
});
} else {
if (chooseId.length >= 20) { if (chooseId.length >= 20) {
my.showToast({ my.showToast({
type: "fail", type: "fail",
...@@ -122,13 +127,6 @@ Component({ ...@@ -122,13 +127,6 @@ Component({
}); });
return; return;
} }
const { item } = e.target.dataset;
if (chooseId.includes(item.itemId)) {
this.setData({
chooseId: chooseId.filter(v => v !== item.itemId),
});
} else {
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