增加搜索功能
This commit is contained in:
@@ -97,9 +97,9 @@
|
||||
<view class="u-font-28 color-666 ">搜索</view>
|
||||
<view class="u-flex u-m-t-20 u-flex-wrap u-row-between">
|
||||
<view class="u-m-b-30" v-for="(goodsItem, goodsIndex) in searchResult" :key="goodsIndex">
|
||||
<goods-item :img="{width:'330rpx',height:'370rpx'}" @chooseGuige="chooseGuige($event,index)"
|
||||
@add="goodsUpdate($event,index,true)" @reduce="goodsUpdate($event,index,false)"
|
||||
:index="goodsIndex" :data="goodsItem"></goods-item>
|
||||
<goods-item :img="{width:'330rpx',height:'330rpx'}" @chooseGuige="chooseGuige($event,goodsItem.index)"
|
||||
@add="goodsUpdate($event,goodsItem.index,true)" @reduce="goodsUpdate($event,index,false)"
|
||||
:index="goodsItem.goodsIndex" :data="goodsItem"></goods-item>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -462,10 +462,21 @@
|
||||
function returnSearchGoods() {
|
||||
const newval = searchValue.value
|
||||
let arr = []
|
||||
let goods=[]
|
||||
for(let i in data.tabbar){
|
||||
const goodsArr=data.tabbar[i].foods||[]
|
||||
for(let k in goodsArr){
|
||||
goods.push({
|
||||
...goodsArr[k],
|
||||
index:i,
|
||||
goodsIndex:k
|
||||
})
|
||||
}
|
||||
}
|
||||
if (newval == "") {
|
||||
arr = $originGoods;
|
||||
arr = goods;
|
||||
} else {
|
||||
arr = $originGoods.filter((v) =>
|
||||
arr = goods.filter((v) =>
|
||||
v.name.includes(newval.trim())
|
||||
);
|
||||
}
|
||||
@@ -984,7 +995,6 @@
|
||||
// watchChooseuser()
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
init()
|
||||
})
|
||||
let isCreateOrderToDetail = ref(false)
|
||||
onLoad((opt) => {
|
||||
@@ -1002,7 +1012,7 @@
|
||||
// go.back()
|
||||
// }, 1500)
|
||||
// }
|
||||
// init()
|
||||
init()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user