|
@@ -83,27 +83,28 @@ function A3goods() {
|
|
|
|
|
|
// 点击搜索
|
|
|
const searchFu = useCallback(
|
|
|
- (val: string, index: 1 | 2 | 3, classKey: string) => {
|
|
|
+ (val: string, acTxt: string, index: 1 | 2 | 3, classKey: string) => {
|
|
|
const dataAllTemp =
|
|
|
index === 1
|
|
|
? myData.goods.img.rowArr
|
|
|
: index === 2
|
|
|
? myData.goods.model.rowArr
|
|
|
: myData.goods.video.rowArr
|
|
|
- let resData: GoodsRow[] = []
|
|
|
|
|
|
- const acTxt = index === 1 ? ac1 : index === 2 ? ac2 : ac3
|
|
|
+ const dataAll = acTxt === '全部' ? dataAllTemp : dataAllTemp.filter(v => v.type === acTxt)
|
|
|
|
|
|
- const dataAll = dataAllTemp.filter(v => v.type === acTxt)
|
|
|
+ let resData: GoodsRow[] = []
|
|
|
|
|
|
if (val === '') resData = dataAll
|
|
|
else resData = dataAll.filter(v => v.name.includes(val))
|
|
|
|
|
|
+ console.log(123, val, resData, acTxt)
|
|
|
+
|
|
|
index === 1 ? setData1(resData) : index === 2 ? setData2(resData) : setData3(resData)
|
|
|
|
|
|
sollrTop(classKey)
|
|
|
},
|
|
|
- [ac1, ac2, ac3, sollrTop]
|
|
|
+ [sollrTop]
|
|
|
)
|
|
|
|
|
|
// 打开详情
|
|
@@ -187,7 +188,12 @@ function A3goods() {
|
|
|
{txtFlag ? (
|
|
|
<Input
|
|
|
onEnterPress={() =>
|
|
|
- searchFu(index === 1 ? txt1 : index === 2 ? txt2 : txt3, index, 'A2Sorrl' + index)
|
|
|
+ searchFu(
|
|
|
+ index === 1 ? txt1 : index === 2 ? txt2 : txt3,
|
|
|
+ acTxt,
|
|
|
+ index,
|
|
|
+ 'A2Sorrl' + index
|
|
|
+ )
|
|
|
}
|
|
|
placeholder='请输入搜索内容'
|
|
|
value={index === 1 ? txt1 : index === 2 ? txt2 : txt3}
|
|
@@ -208,7 +214,12 @@ function A3goods() {
|
|
|
? setTxtFlag2(true)
|
|
|
: setTxtFlag3(true)
|
|
|
} else
|
|
|
- searchFu(index === 1 ? txt1 : index === 2 ? txt2 : txt3, index, 'A2Sorrl' + index)
|
|
|
+ searchFu(
|
|
|
+ index === 1 ? txt1 : index === 2 ? txt2 : txt3,
|
|
|
+ acTxt,
|
|
|
+ index,
|
|
|
+ 'A2Sorrl' + index
|
|
|
+ )
|
|
|
}}
|
|
|
>
|
|
|
<SearchOutline />
|