From 55e9d9fc2953643cec95c74b6ed34b0e68641fb6 Mon Sep 17 00:00:00 2001 From: Vben Date: Wed, 9 Jun 2021 00:22:05 +0800 Subject: [PATCH] perf: optimize components and add comments --- package.json | 16 +- src/components/Application/index.ts | 19 +- .../Application/src/AppDarkModeToggle.vue | 28 ++- .../Application/src/AppLocalePicker.vue | 37 ++-- src/components/Application/src/AppLogo.vue | 70 ++++---- .../Application/src/AppProvider.vue | 22 ++- .../Application/src/search/AppSearch.vue | 2 +- .../src/search/AppSearchFooter.vue | 15 +- .../src/search/AppSearchKeyItem.vue | 4 +- .../Application/src/search/AppSearchModal.vue | 21 +-- .../Application/src/search/useMenuSearch.ts | 31 +++- .../Application/src/useAppContext.ts | 1 - src/components/Authority/index.ts | 5 +- src/components/Authority/src/Authority.vue | 3 - src/components/Basic/index.ts | 11 +- src/components/Basic/src/BasicArrow.vue | 49 ++--- src/components/Basic/src/BasicHelp.vue | 108 +++++------ src/components/Basic/src/BasicTitle.vue | 37 ++-- src/components/Button/index.ts | 8 +- src/components/Button/src/BasicButton.vue | 12 +- .../Button/src/PopConfirmButton.vue | 2 +- src/components/ClickOutSide/index.ts | 5 +- src/components/CodeEditor/index.ts | 6 +- src/components/CodeEditor/src/CodeEditor.vue | 44 +++-- .../CodeEditor/src/codemirror/CodeMirror.vue | 36 ++-- .../CodeEditor/src/codemirror/codemirror.css | 59 ++---- .../src/json-preview/JsonPreview.vue | 8 +- src/components/Container/index.ts | 14 +- .../Container/src/LazyContainer.vue | 66 ++++--- .../Container/src/ScrollContainer.vue | 9 +- .../src/collapse/CollapseContainer.vue | 64 +++---- .../Container/src/collapse/CollapseHeader.vue | 23 +-- .../Container/src/{types.ts => typing.ts} | 0 src/components/FlowChart/index.ts | 4 +- .../Form/src/components/FormAction.vue | 20 +-- src/utils/index.ts | 13 ++ src/utils/install.ts | 12 -- src/views/sys/login/Login.vue | 3 +- types/module.d.ts | 4 +- yarn.lock | 169 +++++++++--------- 40 files changed, 533 insertions(+), 527 deletions(-) rename src/components/Container/src/{types.ts => typing.ts} (100%) delete mode 100644 src/utils/install.ts diff --git a/package.json b/package.json index e395a4cb3..b2c36f428 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@iconify/iconify": "^2.0.1", "@logicflow/core": "^0.4.11", "@logicflow/extension": "^0.4.12", - "@vueuse/core": "^4.11.2", + "@vueuse/core": "^5.0.1", "@zxcvbn-ts/core": "^0.3.0", "ant-design-vue": "2.1.2", "axios": "^0.21.1", @@ -63,7 +63,7 @@ "devDependencies": { "@commitlint/cli": "^12.1.4", "@commitlint/config-conventional": "^12.1.4", - "@iconify/json": "^1.1.353", + "@iconify/json": "^1.1.354", "@purge-icons/generated": "^0.7.0", "@types/codemirror": "^5.60.0", "@types/crypto-js": "^4.0.1", @@ -71,13 +71,13 @@ "@types/inquirer": "^7.3.1", "@types/lodash-es": "^4.17.4", "@types/mockjs": "^1.0.3", - "@types/node": "^15.12.1", + "@types/node": "^15.12.2", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.4.0", "@types/qs": "^6.9.6", "@types/sortablejs": "^1.10.6", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", + "@typescript-eslint/eslint-plugin": "^4.26.1", + "@typescript-eslint/parser": "^4.26.1", "@vitejs/plugin-legacy": "^1.4.1", "@vitejs/plugin-vue": "^1.2.3", "@vitejs/plugin-vue-jsx": "^1.1.5", @@ -92,7 +92,7 @@ "eslint-define-config": "^1.0.8", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-vue": "^7.10.0", - "esno": "^0.7.0", + "esno": "^0.7.1", "fs-extra": "^10.0.0", "http-server": "^0.12.3", "husky": "^6.0.0", @@ -121,14 +121,14 @@ "vite-plugin-style-import": "^0.10.1", "vite-plugin-svg-icons": "^0.7.0", "vite-plugin-theme": "^0.8.1", - "vite-plugin-windicss": "^1.0.1", + "vite-plugin-windicss": "^1.0.2", "vue-eslint-parser": "^7.6.0", "vue-tsc": "^0.1.7" }, "resolutions": { "//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it", "bin-wrapper": "npm:bin-wrapper-china", - "rollup": "^2.51.0" + "rollup": "^2.51.1" }, "repository": { "type": "git", diff --git a/src/components/Application/index.ts b/src/components/Application/index.ts index c1b8fb8b5..d7c513306 100644 --- a/src/components/Application/index.ts +++ b/src/components/Application/index.ts @@ -1,8 +1,15 @@ -import AppLogo from './src/AppLogo.vue'; -import AppProvider from './src/AppProvider.vue'; -import AppSearch from './src/search/AppSearch.vue'; -import AppLocalePicker from './src/AppLocalePicker.vue'; -import AppDarkModeToggle from './src/AppDarkModeToggle.vue'; +import { withInstall } from '/@/utils'; + +import appLogo from './src/AppLogo.vue'; +import appProvider from './src/AppProvider.vue'; +import appSearch from './src/search/AppSearch.vue'; +import appLocalePicker from './src/AppLocalePicker.vue'; +import appDarkModeToggle from './src/AppDarkModeToggle.vue'; export { useAppProviderContext } from './src/useAppContext'; -export { AppLogo, AppProvider, AppSearch, AppLocalePicker, AppDarkModeToggle }; + +export const AppLogo = withInstall(appLogo); +export const AppProvider = withInstall(appProvider); +export const AppSearch = withInstall(appSearch); +export const AppLocalePicker = withInstall(appLocalePicker); +export const AppDarkModeToggle = withInstall(appDarkModeToggle); diff --git a/src/components/Application/src/AppDarkModeToggle.vue b/src/components/Application/src/AppDarkModeToggle.vue index 9363c1aef..bfc7dfb83 100644 --- a/src/components/Application/src/AppDarkModeToggle.vue +++ b/src/components/Application/src/AppDarkModeToggle.vue @@ -1,14 +1,5 @@