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

This commit is contained in:
2024-08-27 15:56:27 +08:00
parent f5b36c5f0e
commit 1516b84c42

View File

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