Skip to content

Commit

Permalink
🐛 Fixing a bug. #I85DEI webstorm不识别ts全局定义的变量
Browse files Browse the repository at this point in the history
  • Loading branch information
lbw committed Oct 3, 2023
1 parent 544f935 commit 2f2516c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ other.elSvg(app);
app
.use(pinia) // pinia 存储
.use(router) // 路由
.use(ElementPlus, { i18n: i18n.global.t }) // ElementPlus 全局引入
.use(ElementPlus) // ElementPlus 全局引入
.use(ElementIcons) // elementIcons 图标全局引入
.use(i18n) // 国际化
.mount('#app');
14 changes: 14 additions & 0 deletions src/types/func.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 定义全局属性的类型
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
import { ComponentCustomProperties } from 'vue';

declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
parseTime: Function;
parseDate: Function;
dateTimeStr: string;
dateStr: string;
timeStr: string;
baseURL: string;
}
}
16 changes: 1 addition & 15 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,4 @@ declare interface TableType<T = any> {
pageSize: number;
[key: string]: T;
};
}

// 定义全局属性的类型
import { ComponentCustomProperties } from 'vue';

declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
parseTime: Function;
parseDate: Function;
dateTimeStr: string;
dateStr: string;
timeStr: string;
baseURL: string;
}
}
}

0 comments on commit 2f2516c

Please sign in to comment.