From c62ba2cf6c0eb31f88925421bc123e167f8652d2 Mon Sep 17 00:00:00 2001 From: pengYYYYY Date: Wed, 1 Sep 2021 18:22:21 +0800 Subject: [PATCH] fix: ts error (merge request !5) Squash merge branch 'fix/tserror' into 'develop' fix: ts error Co-author: pengYYYYY --- globals.d.ts | 4 ++++ src/router/index.ts | 3 +-- src/store/index.ts | 4 ++++ tsconfig.json | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/globals.d.ts b/globals.d.ts index 1756ddc..7e31034 100644 --- a/globals.d.ts +++ b/globals.d.ts @@ -1,3 +1,4 @@ + // 通用声明 declare type ClassName = { [className: string]: any } | ClassName[] | string; @@ -5,9 +6,12 @@ declare interface ImportMeta { env: { MODE: 'mock' | 'development' | 'test' | 'release'; }; + glob: (url: string) => {}; } declare module '*.svg' { const content: string; export default content; } + + diff --git a/src/router/index.ts b/src/router/index.ts index a4c723e..bc523be 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,10 +1,9 @@ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; import routeConfig from '@/config/routes'; -const layoutModules = import.meta.glob('../layouts/*'); +const layoutModules = import.meta.glob('../Layouts/*'); const pagesModules = import.meta.glob('../pages/**/*.vue'); const fristPagesModules = import.meta.glob('../pages/*.vue'); - const modules = Object.assign({}, layoutModules, fristPagesModules, pagesModules); const getMenuRoutes = (list) => { diff --git a/src/store/index.ts b/src/store/index.ts index de2928e..ae405cc 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -8,7 +8,11 @@ export interface State { } export const key: InjectionKey> = Symbol(); + +export const store = createStore({ + modules: { user, + setting, notification, }, }); diff --git a/tsconfig.json b/tsconfig.json index 5de7b38..c7b6225 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,5 +15,5 @@ "@/*": ["./src/*"] } }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/config/proxy.ts", "src/pages/detail/base/index.js"] + "include": ["**/*.ts", "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/config/proxy.ts", "src/pages/detail/base/index.js"] }