修复代课下单商品搜索问题

This commit is contained in:
YeMingfei666 2024-08-27 15:56:27 +08:00
parent f5b36c5f0e
commit 1516b84c42
1 changed files with 7 additions and 5 deletions

View File

@ -1405,15 +1405,17 @@ export default {
});
},
"goods.query.productId": function (newval) {
console.log(newval);
if (newval === "") {
this.goods.list = this.$goodsData.records || [];
if(!this.$goodsData){
return
}
if (newval == "") {
this.goods.list = this.$goodsData || [];
} else {
const newarr = this.$goodsData.records.filter((v) =>
const newarr = this.$goodsData.filter((v) =>
v.name.includes(newval.trim())
);
this.search.list = newarr;
this.goods.list = newarr.length ? newarr : this.$goodsData.records;
this.goods.list = newarr.length ? newarr : this.$goodsData;
}
},
},