feat(热门搜索):筛选系列改为多选

This commit is contained in:
Haiyi 2022-12-14 18:59:03 +08:00
parent 459b40833f
commit 5313c85ddb

View File

@ -37,21 +37,17 @@ const SearchPopup = (props: Props) => {
const handCheckMode = (it) => { const handCheckMode = (it) => {
kindList.map((item) => { kindList.map((item) => {
if (item.id == it.id) { if (item.id == it.id) {
item.check = true item.check = !item.check
}
else {
item.check = false
} }
return item return item
}) })
setKindList([...kindList]) setKindList([...kindList])
// const arr: number[] = [] const arr: number[] = []
const res = kindList.filter((item) => { return item.check }) const res = kindList.filter((item) => { return item.check })
// res.forEach((kb) => { res.forEach((kb) => {
// arr.push(kb.id) arr.push(kb.id)
// }) })
// setsearchObj(val => ({ ...val, product_kind_ids: arr.toString() })) setsearchObj(val => ({ ...val, product_kind_ids: arr.toString() }))
setsearchObj(val => ({ ...val, product_kind_ids: res[0]?.id }))
} }
const handBlur = (e, index) => { const handBlur = (e, index) => {