Skip to content

Commit 5d02fd2

Browse files
committed
fix:家具搜索修复
1 parent a8fe247 commit 5d02fd2

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/components/PvxSearch.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,8 @@ export default {
213213
const filterOptions = this.items.find((item) => item.type === "filter")?.options || [];
214214
filterOptions.forEach((item) => {
215215
if (item.type === "radio") {
216-
const firstOption = item.options[0];
217-
if (firstOption) {
218-
this.formData[item.key] = firstOption.key;
219-
}
216+
const resetOption = item.options.find((option) => option.key === "" || option.value === "全部");
217+
this.formData[item.key] = resetOption ? resetOption.key : "";
220218
} else if (item.type === "checkbox") {
221219
const allOption = item.options.find((opt) => opt.value === "all");
222220
if (allOption) {

src/views/furniture/Index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,13 @@ export default {
400400
});
401401
},
402402
searchEvent(data) {
403-
if (!data.nCatag1Index) {
403+
const newData = this.doPrams(data);
404+
const hasSearchValue = Object.values(newData || {}).some((value) => {
405+
if (Array.isArray(value)) return value.length;
406+
return ![undefined, null, ""].includes(value);
407+
});
408+
409+
if (!hasSearchValue) {
404410
this.active = "";
405411
this.search = {};
406412
this.list = [];
@@ -409,7 +415,6 @@ export default {
409415
return;
410416
}
411417
this.active = data.nCatag1Index;
412-
const newData = this.doPrams(data);
413418
this.search = newData;
414419
},
415420
loadFurniture() {

0 commit comments

Comments
 (0)