You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
taicangZongzhi-PC/src/utils/myselfFu.js

25 lines
604 B

import store from "@/store";
// 翻译区域
export function filterTown(ids) {
if (ids && Array.isArray(ids)) {
let data = store.getters.townList;
const targetIds = ids;
const results = [];
filterNames(data, targetIds, results);
return results.join(" / ");
}
}
function filterNames(data, targetIds, results) {
data.forEach((node, index) => {
if (targetIds.includes(node.id)) {
results.push(node.label);
}
const children = node.children;
if (Array.isArray(children) && children.length > 0) {
filterNames(children, targetIds, results);
}
});
}