!5 优化 类型定义提高编码体验

Merge pull request !5 from kangert/master
This commit is contained in:
lyt-Top 2021-06-17 12:43:17 +08:00 committed by Gitee
commit fa34433aa1
2 changed files with 3 additions and 3 deletions

View File

@ -858,7 +858,7 @@ const pathMatch = {
};
// 获取目录下的 .vue 全部文件,参考 viteimport.meta.glob
const dynamicViewsModules = import.meta.glob('../views/**/*.{vue,tsx}');
const dynamicViewsModules: Record<string, Function> = import.meta.glob('../views/**/*.{vue,tsx}');
// 添加静态路由
const router = createRouter({
@ -919,7 +919,7 @@ export function backEndRouter(routes: any) {
}
// 后端控制路由,后端路由 component 转换函数
export function dynamicImport(dynamicViewsModules: Record<string, () => Promise<{ [key: string]: any }>>, component: string) {
export function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string) {
const keys = Object.keys(dynamicViewsModules);
const matchKeys = keys.filter((key) => {
const k = key.replace('../views', '');

View File

@ -9,7 +9,7 @@ export interface ViteEnv {
export function loadEnv(): ViteEnv {
const env = process.env.NODE_ENV;
const ret: any = {};
const envList = [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env', ,];
const envList = [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env', ];
envList.forEach((e) => {
dotenv.config({ path: e });
});