🐛 Fixing a bug. #I85DEI webstorm不识别ts全局定义的变量

This commit is contained in:
lbw 2023-10-03 14:03:46 +08:00
parent 544f93576c
commit 2f2516c322
3 changed files with 16 additions and 16 deletions

View File

@ -46,7 +46,7 @@ other.elSvg(app);
app app
.use(pinia) // pinia 存储 .use(pinia) // pinia 存储
.use(router) // 路由 .use(router) // 路由
.use(ElementPlus, { i18n: i18n.global.t }) // ElementPlus 全局引入 .use(ElementPlus) // ElementPlus 全局引入
.use(ElementIcons) // elementIcons 图标全局引入 .use(ElementIcons) // elementIcons 图标全局引入
.use(i18n) // 国际化 .use(i18n) // 国际化
.mount('#app'); .mount('#app');

14
src/types/func.ts Normal file
View File

@ -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
src/types/global.d.ts vendored
View File

@ -105,18 +105,4 @@ declare interface TableType<T = any> {
pageSize: number; pageSize: number;
[key: string]: T; [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;
}
}