mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-12 05:01:03 +00:00
优化列表的展示顺序
This commit is contained in:
parent
771593f948
commit
851c50a5f3
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user