From 980f4ae145abe13687d87961b06af3f4777af701 Mon Sep 17 00:00:00 2001 From: chenxi-20 <76168465+chenxi-20@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:49:03 +0800 Subject: [PATCH] feat(icon): [icon] add sorting function (#1182) --- examples/sites/demos/pc/app/icon/list-composition-api.vue | 8 ++++++++ examples/sites/demos/pc/app/icon/list.vue | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/examples/sites/demos/pc/app/icon/list-composition-api.vue b/examples/sites/demos/pc/app/icon/list-composition-api.vue index 1d4f7df7a..ac75c950c 100644 --- a/examples/sites/demos/pc/app/icon/list-composition-api.vue +++ b/examples/sites/demos/pc/app/icon/list-composition-api.vue @@ -32,6 +32,14 @@ import { iconGroups } from './iconGroups.js' const all = Object.values(iconGroups).flat() iconGroups.Others = Object.keys(Svgs).filter((name) => !all.includes(name) && name[0] === 'I') + +// 排序 +Object.keys(iconGroups).forEach((k) => { + iconGroups[k] = iconGroups[k].sort((a, b) => { + return a > b ? 1 : -1 + }) +}) + const searchName = ref('') function click(name) { diff --git a/examples/sites/demos/pc/app/icon/list.vue b/examples/sites/demos/pc/app/icon/list.vue index b8798c649..180ba4970 100644 --- a/examples/sites/demos/pc/app/icon/list.vue +++ b/examples/sites/demos/pc/app/icon/list.vue @@ -37,6 +37,13 @@ export default { const all = Object.values(iconGroups).flat() iconGroups.Others = Object.keys(Svgs).filter((name) => !all.includes(name) && name[0] === 'I') + // 排序 + Object.keys(iconGroups).forEach((k) => { + iconGroups[k] = iconGroups[k].sort((a, b) => { + return a > b ? 1 : -1 + }) + }) + return { iconGroups, Svgs,