优化列表的展示顺序

This commit is contained in:
xu_yanfeng 2025-02-13 15:54:04 +08:00
parent 771593f948
commit 851c50a5f3

View File

@ -20,17 +20,21 @@ export default defineComponent({
if (data) {
data.sortByName();
console.log(data);
const result: ToolItem[] = [];
data.data.forEach((item) => {
item.getTryInfos().forEach((info) => {
let arr = list.value.find((item) => item.type === info.type);
let arr = result.find((item) => item.type === info.type);
if (!arr) {
arr = new ToolItem(info.type);
arr.title = data.keys[info.type] || info.type || "推荐列表";
list.value.push(arr);
result.push(arr);
}
arr.items.push({ name: info.name, url: info.url, store: item.store });
});
});
// type
result.sort((a, b) => b.type.localeCompare(a.type));
list.value = result;
}
});
return {