From 2d56e471cbd7429630cc1cde979d3e25e01f6288 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Sun, 27 Nov 2022 10:00:30 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=97=A0=E9=9C=80=E5=AE=89=E8=A3=85=20?= =?UTF-8?q?`@vue/runtime-core`=EF=BC=8C=E5=85=BC=E5=AE=B9=20`element-plus`?= =?UTF-8?q?=20=E7=9A=84=E7=BB=84=E4=BB=B6=20`volar`=20=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - pnpm-lock.yaml | 2 - src/utils/sso.ts | 2 +- tsconfig.json | 5 +- types/global-components.d.ts | 124 +++++++++++++++++++++++++++++++++++++++++++ types/global.d.ts | 12 ----- 6 files changed, 127 insertions(+), 19 deletions(-) create mode 100644 types/global-components.d.ts diff --git a/package.json b/package.json index ea0d1c0..4ed622b 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "@vitejs/plugin-vue-jsx": "^2.1.1", "@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-typescript": "^11.0.2", - "@vue/runtime-core": "^3.2.45", "autoprefixer": "^10.4.13", "cloc": "^2.10.0", "cssnano": "^5.1.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e2d29af..51b042a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,7 +27,6 @@ specifiers: "@vitejs/plugin-vue-jsx": ^2.1.1 "@vue/eslint-config-prettier": ^7.0.0 "@vue/eslint-config-typescript": ^11.0.2 - "@vue/runtime-core": ^3.2.45 "@vueuse/core": ^9.6.0 "@vueuse/motion": 2.0.0-beta.12 animate.css: ^4.1.1 @@ -147,7 +146,6 @@ devDependencies: "@vitejs/plugin-vue-jsx": 2.1.1_vite@3.1.8+vue@3.2.45 "@vue/eslint-config-prettier": 7.0.0_5qrnzwqb344w6up62gv3safeoi "@vue/eslint-config-typescript": 11.0.2_5ma4o5namqj2syekqcvrgakwe4 - "@vue/runtime-core": 3.2.45 autoprefixer: 10.4.13_postcss@8.4.19 cloc: 2.10.0 cssnano: 5.1.14_postcss@8.4.19 diff --git a/src/utils/sso.ts b/src/utils/sso.ts index 7b51622..69b0509 100644 --- a/src/utils/sso.ts +++ b/src/utils/sso.ts @@ -2,7 +2,7 @@ import { removeToken, setToken, type DataInfo } from "./auth"; import { subBefore, getQueryMap } from "@pureadmin/utils"; /** - * 简版前端单点登录,根据实际业务自行编写,平台启动后本地可以跳后面这个链接进行测试 http://localhost:8848/#/permission/page/index?username=sso&roles=admin&accessToken=eyJhbGciOiJIUzUxMiJ9.admin + * 简版前端单点登录,根据实际业务自行编写 * 划重点: * 判断是否为单点登录,不为则直接返回不再进行任何逻辑处理,下面是单点登录后的逻辑处理 * 1.清空本地旧信息; diff --git a/tsconfig.json b/tsconfig.json index dd0c5fe..0cb30b9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,8 +21,7 @@ "incremental": true, "paths": { "@/*": ["src/*"], - "@build/*": ["build/*"], - "/#/*": ["types/*"] + "@build/*": ["build/*"] }, "types": [ "node", @@ -35,11 +34,11 @@ "typeRoots": ["./node_modules/@types/", "./types"] }, "include": [ + "mock/*.ts", "src/**/*.ts", "src/**/*.tsx", "src/**/*.vue", "types/*.d.ts", - "mock/*.ts", "vite.config.ts" ], "exclude": ["node_modules", "dist", "**/*.js"] diff --git a/types/global-components.d.ts b/types/global-components.d.ts new file mode 100644 index 0000000..35d2df0 --- /dev/null +++ b/types/global-components.d.ts @@ -0,0 +1,124 @@ +declare module "vue" { + /** + * 自定义全局组件获得 Volar 提示(自定义的全局组件需要在这里声明下才能获得 Volar 类型提示哦) + */ + export interface GlobalComponents { + IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"]; + IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"]; + FontIcon: typeof import("../src/components/ReIcon")["FontIcon"]; + Auth: typeof import("../src/components/ReAuth")["Auth"]; + } +} + +/** + * todo:https://github.com/element-plus/element-plus/blob/dev/global.d.ts#L2 + * No need to install @vue/runtime-core + */ +declare module "vue" { + export interface GlobalComponents { + ElAffix: typeof import("element-plus")["ElAffix"]; + ElAlert: typeof import("element-plus")["ElAlert"]; + ElAside: typeof import("element-plus")["ElAside"]; + ElAutocomplete: typeof import("element-plus")["ElAutocomplete"]; + ElAvatar: typeof import("element-plus")["ElAvatar"]; + ElBacktop: typeof import("element-plus")["ElBacktop"]; + ElBadge: typeof import("element-plus")["ElBadge"]; + ElBreadcrumb: typeof import("element-plus")["ElBreadcrumb"]; + ElBreadcrumbItem: typeof import("element-plus")["ElBreadcrumbItem"]; + ElButton: typeof import("element-plus")["ElButton"]; + ElButtonGroup: typeof import("element-plus")["ElButtonGroup"]; + ElCalendar: typeof import("element-plus")["ElCalendar"]; + ElCard: typeof import("element-plus")["ElCard"]; + ElCarousel: typeof import("element-plus")["ElCarousel"]; + ElCarouselItem: typeof import("element-plus")["ElCarouselItem"]; + ElCascader: typeof import("element-plus")["ElCascader"]; + ElCascaderPanel: typeof import("element-plus")["ElCascaderPanel"]; + ElCheckbox: typeof import("element-plus")["ElCheckbox"]; + ElCheckboxButton: typeof import("element-plus")["ElCheckboxButton"]; + ElCheckboxGroup: typeof import("element-plus")["ElCheckboxGroup"]; + ElCol: typeof import("element-plus")["ElCol"]; + ElCollapse: typeof import("element-plus")["ElCollapse"]; + ElCollapseItem: typeof import("element-plus")["ElCollapseItem"]; + ElCollapseTransition: typeof import("element-plus")["ElCollapseTransition"]; + ElColorPicker: typeof import("element-plus")["ElColorPicker"]; + ElContainer: typeof import("element-plus")["ElContainer"]; + ElConfigProvider: typeof import("element-plus")["ElConfigProvider"]; + ElDatePicker: typeof import("element-plus")["ElDatePicker"]; + ElDialog: typeof import("element-plus")["ElDialog"]; + ElDivider: typeof import("element-plus")["ElDivider"]; + ElDrawer: typeof import("element-plus")["ElDrawer"]; + ElDropdown: typeof import("element-plus")["ElDropdown"]; + ElDropdownItem: typeof import("element-plus")["ElDropdownItem"]; + ElDropdownMenu: typeof import("element-plus")["ElDropdownMenu"]; + ElEmpty: typeof import("element-plus")["ElEmpty"]; + ElFooter: typeof import("element-plus")["ElFooter"]; + ElForm: typeof import("element-plus")["ElForm"]; + ElFormItem: typeof import("element-plus")["ElFormItem"]; + ElHeader: typeof import("element-plus")["ElHeader"]; + ElIcon: typeof import("element-plus")["ElIcon"]; + ElImage: typeof import("element-plus")["ElImage"]; + ElImageViewer: typeof import("element-plus")["ElImageViewer"]; + ElInput: typeof import("element-plus")["ElInput"]; + ElInputNumber: typeof import("element-plus")["ElInputNumber"]; + ElLink: typeof import("element-plus")["ElLink"]; + ElMain: typeof import("element-plus")["ElMain"]; + ElMenu: typeof import("element-plus")["ElMenu"]; + ElMenuItem: typeof import("element-plus")["ElMenuItem"]; + ElMenuItemGroup: typeof import("element-plus")["ElMenuItemGroup"]; + ElOption: typeof import("element-plus")["ElOption"]; + ElOptionGroup: typeof import("element-plus")["ElOptionGroup"]; + ElPageHeader: typeof import("element-plus")["ElPageHeader"]; + ElPagination: typeof import("element-plus")["ElPagination"]; + ElPopconfirm: typeof import("element-plus")["ElPopconfirm"]; + ElPopper: typeof import("element-plus")["ElPopper"]; + ElPopover: typeof import("element-plus")["ElPopover"]; + ElProgress: typeof import("element-plus")["ElProgress"]; + ElRadio: typeof import("element-plus")["ElRadio"]; + ElRadioButton: typeof import("element-plus")["ElRadioButton"]; + ElRadioGroup: typeof import("element-plus")["ElRadioGroup"]; + ElRate: typeof import("element-plus")["ElRate"]; + ElRow: typeof import("element-plus")["ElRow"]; + ElScrollbar: typeof import("element-plus")["ElScrollbar"]; + ElSelect: typeof import("element-plus")["ElSelect"]; + ElSlider: typeof import("element-plus")["ElSlider"]; + ElStep: typeof import("element-plus")["ElStep"]; + ElSteps: typeof import("element-plus")["ElSteps"]; + ElSubMenu: typeof import("element-plus")["ElSubMenu"]; + ElSwitch: typeof import("element-plus")["ElSwitch"]; + ElTabPane: typeof import("element-plus")["ElTabPane"]; + ElTable: typeof import("element-plus")["ElTable"]; + ElTableColumn: typeof import("element-plus")["ElTableColumn"]; + ElTabs: typeof import("element-plus")["ElTabs"]; + ElTag: typeof import("element-plus")["ElTag"]; + ElTimePicker: typeof import("element-plus")["ElTimePicker"]; + ElTimeSelect: typeof import("element-plus")["ElTimeSelect"]; + ElTimeline: typeof import("element-plus")["ElTimeline"]; + ElTimelineItem: typeof import("element-plus")["ElTimelineItem"]; + ElTooltip: typeof import("element-plus")["ElTooltip"]; + ElTransfer: typeof import("element-plus")["ElTransfer"]; + ElTree: typeof import("element-plus")["ElTree"]; + ElTreeV2: typeof import("element-plus")["ElTreeV2"]; + ElUpload: typeof import("element-plus")["ElUpload"]; + ElSpace: typeof import("element-plus")["ElSpace"]; + ElSkeleton: typeof import("element-plus")["ElSkeleton"]; + ElSkeletonItem: typeof import("element-plus")["ElSkeletonItem"]; + ElCheckTag: typeof import("element-plus")["ElCheckTag"]; + ElDescriptions: typeof import("element-plus")["ElDescriptions"]; + ElDescriptionsItem: typeof import("element-plus")["ElDescriptionsItem"]; + ElResult: typeof import("element-plus")["ElResult"]; + ElSelectV2: typeof import("element-plus")["ElSelectV2"]; + } + + interface ComponentCustomProperties { + $message: typeof import("element-plus")["ElMessage"]; + $notify: typeof import("element-plus")["ElNotification"]; + $msgbox: typeof import("element-plus")["ElMessageBox"]; + $messageBox: typeof import("element-plus")["ElMessageBox"]; + $alert: typeof import("element-plus")["ElMessageBox"]["alert"]; + $confirm: typeof import("element-plus")["ElMessageBox"]["confirm"]; + $prompt: typeof import("element-plus")["ElMessageBox"]["prompt"]; + $loading: typeof import("element-plus")["ElLoadingService"]; + } +} + +export {}; diff --git a/types/global.d.ts b/types/global.d.ts index bce918c..ffe427b 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -265,15 +265,3 @@ declare global { $config: ServerConfigs; } } - -declare module "vue" { - /** - * 自定义全局组件获得 Volar 提示(自定义的全局组件需要在这里声明下才能获得 Volar 类型提示哦) - */ - export interface GlobalComponents { - IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"]; - IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"]; - FontIcon: typeof import("../src/components/ReIcon")["FontIcon"]; - Auth: typeof import("../src/components/ReAuth")["Auth"]; - } -}