提交 8e2ef001 authored 作者: 龙菲's avatar 龙菲

修复文物年代搜索并删除无子集的children

上级 2c05f6dd
......@@ -194,7 +194,6 @@
import ListBanner from "@/components/ListBanner";
import { getCulturalRelicList } from "@/api/culturalRelic";
import { mapGetters } from "vuex";
import { debounce } from "@/utils/index";
export default {
name: "CulturalRelic",
components: { ListBanner },
......@@ -229,6 +228,18 @@ export default {
"culturalRelicYears",
]);
this.culturalRelicYears = res.culturalRelicYears;
traveseYears(this.culturalRelicYears);
function traveseYears(arr) {
if (arr &&arr.length > 0) {
arr.map((item) => {
if (item.children && item.children.length == 0) {
delete item.children;
} else {
traveseYears(item.children);
}
});
}
}
},
mounted() {
this.loadData();
......@@ -256,9 +267,6 @@ export default {
type: this.type,
years: this.years,
};
if (params.years.length == 0) {
delete params.years;
}
let res = await getCulturalRelicList(params);
if (res.code == 0) {
this.list = res.data;
......@@ -295,7 +303,11 @@ export default {
this.loadData();
},
handleYearsChange(value) {
if (value && value instanceof Array) {
this.years = value[value.length - 1];
} else {
this.years = value;
}
this.loadData();
this.$refs.years.dropDownVisible = false;
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论