forked from opentiny/tiny-vue
feat(icon): [icon] add sorting function (#1182)
This commit is contained in:
parent
cbabdca9b8
commit
980f4ae145
|
@ -32,6 +32,14 @@ import { iconGroups } from './iconGroups.js'
|
||||||
|
|
||||||
const all = Object.values(iconGroups).flat()
|
const all = Object.values(iconGroups).flat()
|
||||||
iconGroups.Others = Object.keys(Svgs).filter((name) => !all.includes(name) && name[0] === 'I')
|
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('')
|
const searchName = ref('')
|
||||||
|
|
||||||
function click(name) {
|
function click(name) {
|
||||||
|
|
|
@ -37,6 +37,13 @@ export default {
|
||||||
const all = Object.values(iconGroups).flat()
|
const all = Object.values(iconGroups).flat()
|
||||||
iconGroups.Others = Object.keys(Svgs).filter((name) => !all.includes(name) && name[0] === 'I')
|
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 {
|
return {
|
||||||
iconGroups,
|
iconGroups,
|
||||||
Svgs,
|
Svgs,
|
||||||
|
|
Loading…
Reference in New Issue