From 7e9c4a6109b417a577d9ac9ecf02db52eb1964af Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Wed, 5 Jun 2024 16:26:46 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=A6=BB=E7=BA=BF=E5=9B=BE=E6=A0=87=E5=90=8E=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=85=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.base | 2 +- .env.dev | 2 +- .env.gitee | 2 +- .env.pro | 2 +- .env.test | 2 +- mock/menu/index.mock.ts | 8 +- mock/role/index.mock.ts | 36 +- scripts/icon.ts | 6 +- src/components/Collapse/src/Collapse.vue | 2 +- .../ContentWrap/src/ContentWrap.vue | 2 +- .../Descriptions/src/Descriptions.vue | 6 +- src/components/Dialog/src/Dialog.vue | 6 +- src/components/Icon/src/Icon.vue | 7 +- .../IconPicker/src/data/icons.ant-design.ts | 1621 +++++------ .../IconPicker/src/data/icons.ep.ts | 588 ++-- .../IconPicker/src/data/icons.tdesign.ts | 2408 ++++++++--------- .../ImageCropping/src/ImageCropping.vue | 16 +- src/components/Infotip/src/Infotip.vue | 2 +- .../LocaleDropdown/src/LocaleDropdown.vue | 2 +- src/components/Qrcode/src/Qrcode.vue | 2 +- src/components/Screenfull/src/Screenfull.vue | 2 +- .../Search/src/components/ActionButton.vue | 6 +- src/components/Setting/src/Setting.vue | 2 +- .../src/components/ColorRadioPicker.vue | 2 +- .../SizeDropdown/src/SizeDropdown.vue | 2 +- src/components/Table/src/Table.vue | 2 +- .../Table/src/components/ColumnSetting.vue | 8 +- .../Table/src/components/TableActions.vue | 6 +- src/components/TagsView/src/TagsView.vue | 34 +- .../ThemeSwitch/src/ThemeSwitch.vue | 4 +- .../UserInfo/src/components/LockPage.vue | 2 +- .../src/VideoPlayerViewer.vue | 2 +- src/constants/index.ts | 5 + src/router/index.ts | 20 +- src/views/Components/Icon.vue | 8 +- src/views/Login/components/LoginForm.vue | 8 +- types/env.d.ts | 16 - types/global.d.ts | 17 + uno.config.ts | 10 +- 39 files changed, 2466 insertions(+), 2412 deletions(-) diff --git a/.env.base b/.env.base index 8f60256..1c8fd7c 100644 --- a/.env.base +++ b/.env.base @@ -17,4 +17,4 @@ VITE_USE_ALL_ELEMENT_PLUS_STYLE=true VITE_USE_MOCK=true # 是否使用在线图标 -VITE_USE_ONLINE_ICON=true \ No newline at end of file +VITE_USE_ONLINE_ICON=true diff --git a/.env.dev b/.env.dev index 4727386..a4d6b3a 100644 --- a/.env.dev +++ b/.env.dev @@ -35,4 +35,4 @@ VITE_USE_MOCK=true VITE_USE_CSS_SPLIT=true # 是否使用在线图标 -VITE_USE_ONLINE_ICON=true \ No newline at end of file +VITE_USE_ONLINE_ICON=true diff --git a/.env.gitee b/.env.gitee index bcd0b11..1a14f0a 100644 --- a/.env.gitee +++ b/.env.gitee @@ -35,4 +35,4 @@ VITE_USE_MOCK=true VITE_USE_CSS_SPLIT=true # 是否使用在线图标 -VITE_USE_ONLINE_ICON=true \ No newline at end of file +VITE_USE_ONLINE_ICON=true diff --git a/.env.pro b/.env.pro index a35e73b..edc668e 100644 --- a/.env.pro +++ b/.env.pro @@ -35,4 +35,4 @@ VITE_USE_MOCK=true VITE_USE_CSS_SPLIT=true # 是否使用在线图标 -VITE_USE_ONLINE_ICON=false \ No newline at end of file +VITE_USE_ONLINE_ICON=false diff --git a/.env.test b/.env.test index ee881dd..b53f347 100644 --- a/.env.test +++ b/.env.test @@ -35,4 +35,4 @@ VITE_USE_MOCK=true VITE_USE_CSS_SPLIT=false # 是否使用在线图标 -VITE_USE_ONLINE_ICON=true \ No newline at end of file +VITE_USE_ONLINE_ICON=true diff --git a/mock/menu/index.mock.ts b/mock/menu/index.mock.ts index fd3f732..092dbc5 100644 --- a/mock/menu/index.mock.ts +++ b/mock/menu/index.mock.ts @@ -26,7 +26,7 @@ export default [ title: '首页', meta: { title: '首页', - icon: 'ant-design:dashboard-filled', + icon: 'vi-ant-design:dashboard-filled', alwaysShow: true }, children: [ @@ -90,7 +90,7 @@ export default [ component: '#', meta: { title: '文档', - icon: 'clarity:document-solid' + icon: 'vi-clarity:document-solid' }, name: 'ExternalLink', status: Mock.Random.integer(0, 1), @@ -125,7 +125,7 @@ export default [ title: '菜单', meta: { title: '菜单', - icon: 'carbon:skill-level-advanced' + icon: 'vi-carbon:skill-level-advanced' }, children: [ { @@ -214,7 +214,7 @@ export default [ title: '综合示例', meta: { title: '综合示例', - icon: 'ep:management', + icon: 'vi-ep:management', alwaysShow: true }, children: [ diff --git a/mock/role/index.mock.ts b/mock/role/index.mock.ts index 7aae345..a0ec69c 100644 --- a/mock/role/index.mock.ts +++ b/mock/role/index.mock.ts @@ -12,7 +12,7 @@ const adminList = [ name: 'Dashboard', meta: { title: 'router.dashboard', - icon: 'ant-design:dashboard-filled', + icon: 'vi-ant-design:dashboard-filled', alwaysShow: true }, children: [ @@ -49,7 +49,7 @@ const adminList = [ name: 'DocumentLink', meta: { title: 'router.document', - icon: 'clarity:document-solid' + icon: 'vi-clarity:document-solid' } } ] @@ -66,7 +66,7 @@ const adminList = [ name: 'GuideDemo', meta: { title: 'router.guide', - icon: 'cib:telegram-plane' + icon: 'vi-cib:telegram-plane' } } ] @@ -78,7 +78,7 @@ const adminList = [ name: 'ComponentsDemo', meta: { title: 'router.component', - icon: 'bx:bxs-component', + icon: 'vi-bx:bxs-component', alwaysShow: true }, children: [ @@ -358,7 +358,7 @@ const adminList = [ name: 'Function', meta: { title: 'router.function', - icon: 'ri:function-fill', + icon: 'vi-ri:function-fill', alwaysShow: true }, children: [ @@ -406,7 +406,7 @@ const adminList = [ name: 'Hooks', meta: { title: 'hooks', - icon: 'ic:outline-webhook', + icon: 'vi-ic:outline-webhook', alwaysShow: true }, children: [ @@ -467,7 +467,7 @@ const adminList = [ name: 'Level', meta: { title: 'router.level', - icon: 'carbon:skill-level-advanced' + icon: 'vi-carbon:skill-level-advanced' }, children: [ { @@ -526,7 +526,7 @@ const adminList = [ name: 'Example', meta: { title: 'router.example', - icon: 'ep:management', + icon: 'vi-ep:management', alwaysShow: true }, children: [ @@ -594,7 +594,7 @@ const adminList = [ name: 'Error', meta: { title: 'router.errorPage', - icon: 'ci:error', + icon: 'vi-ci:error', alwaysShow: true }, children: [ @@ -631,7 +631,7 @@ const adminList = [ name: 'Authorization', meta: { title: 'router.authorization', - icon: 'eos-icons:role-binding', + icon: 'vi-eos-icons:role-binding', alwaysShow: true }, children: [ @@ -762,7 +762,7 @@ const menus = [ id: 1, meta: { title: '首页', - icon: 'ant-design:dashboard-filled', + icon: 'vi-ant-design:dashboard-filled', alwaysShow: true }, children: [ @@ -795,7 +795,7 @@ const menus = [ component: '#', meta: { title: '文档', - icon: 'clarity:document-solid' + icon: 'vi-clarity:document-solid' }, name: 'ExternalLink', status: Mock.Random.integer(0, 1), @@ -821,7 +821,7 @@ const menus = [ id: 6, meta: { title: '菜单', - icon: 'carbon:skill-level-advanced' + icon: 'vi-carbon:skill-level-advanced' }, children: [ { @@ -898,7 +898,7 @@ const menus = [ id: 12, meta: { title: '综合示例', - icon: 'ep:management', + icon: 'vi-ep:management', alwaysShow: true }, children: [ @@ -990,7 +990,7 @@ const menus = [ id: 1, meta: { title: '首页', - icon: 'ant-design:dashboard-filled', + icon: 'vi-ant-design:dashboard-filled', alwaysShow: true }, children: [ @@ -1025,7 +1025,7 @@ const menus = [ component: '#', meta: { title: '文档', - icon: 'clarity:document-solid' + icon: 'vi-clarity:document-solid' }, name: 'ExternalLink', status: Mock.Random.integer(0, 1), @@ -1051,7 +1051,7 @@ const menus = [ id: 6, meta: { title: '菜单', - icon: 'carbon:skill-level-advanced' + icon: 'vi-carbon:skill-level-advanced' }, children: [ { @@ -1130,7 +1130,7 @@ const menus = [ id: 12, meta: { title: '综合示例', - icon: 'ep:management', + icon: 'vi-ep:management', alwaysShow: true }, children: [ diff --git a/scripts/icon.ts b/scripts/icon.ts index 27c33e5..724342e 100644 --- a/scripts/icon.ts +++ b/scripts/icon.ts @@ -3,6 +3,7 @@ import fs from 'fs-extra' import inquirer from 'inquirer' import chalk from 'chalk' import pkg from '../package.json' +import { ICON_PREFIX } from '../src/constants' interface Icon { name: string @@ -52,11 +53,12 @@ async function generateIcon() { const data = await fs.readJSON(path.join(dir, 'json', `${info.id}.json`)) if (data) { const { prefix } = data - const icons = Object.keys(data.icons).map((item) => `${prefix}:${item}`) + const prefixName = `${ICON_PREFIX}${prefix}` + const icons = Object.keys(data.icons).map((item) => `${prefixName}:${item}`) await fs.writeFileSync( path.join('src/components/IconPicker/src/data', `icons.${prefix}.ts`), - `export default ${JSON.stringify({ name: info.name, prefix, icons })}` + `export default ${JSON.stringify({ name: info.name, prefix: prefixName, icons })}` ) // ↓分类处理完成,push类型名称 prefixSet.push(prefix) diff --git a/src/components/Collapse/src/Collapse.vue b/src/components/Collapse/src/Collapse.vue index 6d6362e..542d9d3 100644 --- a/src/components/Collapse/src/Collapse.vue +++ b/src/components/Collapse/src/Collapse.vue @@ -26,7 +26,7 @@ const toggleCollapse = () => {
diff --git a/src/components/ContentWrap/src/ContentWrap.vue b/src/components/ContentWrap/src/ContentWrap.vue index 60c9aa9..8557e81 100644 --- a/src/components/ContentWrap/src/ContentWrap.vue +++ b/src/components/ContentWrap/src/ContentWrap.vue @@ -22,7 +22,7 @@ defineProps({ - +
diff --git a/src/components/Descriptions/src/Descriptions.vue b/src/components/Descriptions/src/Descriptions.vue index 3463dbf..2c773b8 100644 --- a/src/components/Descriptions/src/Descriptions.vue +++ b/src/components/Descriptions/src/Descriptions.vue @@ -97,12 +97,14 @@ export default defineComponent({ {props.title} {props.message ? ( - + ) : null}
- {props.collapse ? : null} + {props.collapse ? ( + + ) : null} ) : null} diff --git a/src/components/Dialog/src/Dialog.vue b/src/components/Dialog/src/Dialog.vue index 7bba971..9534db0 100644 --- a/src/components/Dialog/src/Dialog.vue +++ b/src/components/Dialog/src/Dialog.vue @@ -78,14 +78,16 @@ const dialogStyle = computed(() => { { color } }) + +const getIconName = computed(() => { + return props.icon.startsWith(ICON_PREFIX) ? props.icon.replace(ICON_PREFIX, '') : props.icon +}) diff --git a/src/components/SizeDropdown/src/SizeDropdown.vue b/src/components/SizeDropdown/src/SizeDropdown.vue index 1edbf74..eb55917 100644 --- a/src/components/SizeDropdown/src/SizeDropdown.vue +++ b/src/components/SizeDropdown/src/SizeDropdown.vue @@ -27,7 +27,7 @@ const setCurrentSize = (size: ComponentSize) => {