Browse Source

perf: 无需安装 `@vue/runtime-core`,兼容 `element-plus` 的组件 `volar` 提示

i18n
xiaoxian521 2 years ago
parent
commit
2d56e471cb
  1. 1
      package.json
  2. 2
      pnpm-lock.yaml
  3. 2
      src/utils/sso.ts
  4. 5
      tsconfig.json
  5. 124
      types/global-components.d.ts
  6. 12
      types/global.d.ts

1
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",

2
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

2
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.

5
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"]

124
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"];
}
}
/**
* todohttps://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 {};

12
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"];
}
}
Loading…
Cancel
Save