feat(icon): [icon] add sorting function (#1182)

This commit is contained in:
chenxi-20 2023-12-22 15:49:03 +08:00 committed by GitHub
parent cbabdca9b8
commit 980f4ae145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -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) {

View File

@ -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,