feat: 产品列表与解决方案列表的排序 #69

Manually merged
remilia merged 4 commits from feat/type-sort into master 2025-11-08 15:51:41 +08:00
6 changed files with 64 additions and 26 deletions
Showing only changes of commit a34cfaff6f - Show all commits

View File

@ -8,7 +8,7 @@
<div class="products-container">
<el-collapse v-model="activeNames" class="product-collapse">
<el-collapse-item
v-for="[key, value] in groupedProducts"
v-for="[key, value] in Object.entries(groupedProducts)"
:key="key"
:title="key || '未分类'"
:name="key || 'no-category'"
@ -64,9 +64,9 @@
}
groups[typeKey]?.data.push(prod);
}
const sortedGroups = Object.entries(groups)
.sort(([, a], [, b]) => a.sort - b.sort)
.map(([key, value]) => [key, value]);
const sortedGroups = Object.fromEntries(
Object.entries(groups).sort(([, a], [, b]) => a.sort - b.sort)
);
return sortedGroups;
});