From b8b85a582b2e0b52b9248be0f0b9179cb0b00fb8 Mon Sep 17 00:00:00 2001 From: "WANGFAN\\wangf" <15871339963@163.com> Date: Tue, 3 Dec 2024 15:01:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dvue-router=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=BC=95=E5=85=A5=E6=8A=A5=E9=94=99=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route-config.ts | 3 +-- src/vite-env.d.ts | 1 - tsconfig.json | 7 +++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/store/modules/route-config.ts b/src/store/modules/route-config.ts index c6fedee..b187f35 100644 --- a/src/store/modules/route-config.ts +++ b/src/store/modules/route-config.ts @@ -1,5 +1,5 @@ import { defineStore } from "pinia"; -import router from "@/router/index.ts"; +import router from "@/router/index"; import { RouteRecordRaw } from "vue-router"; import { getMenuListAPI } from "@/api/modules/system/index"; import { moduleReplacement, linearArray } from "@/router/route-output"; @@ -103,7 +103,6 @@ export const useRoutesConfigStore = defineStore("route-config", { tree[0].redirect = tree[0].children[0].path; // 6、动态添加路由 tree.forEach((route: RouteRecordRaw) => router.addRoute(route)); - console.log("最终路由", tree); // 7、缓存一维路由 this.routeList = tree[0].children; } diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index b15930c..ce20f09 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -19,4 +19,3 @@ declare module "@/directives/modules/custom"; declare module "mockjs"; declare module "@/store/modules/route-config"; declare module "@arco-design/*"; -declare module "vue-router"; diff --git a/tsconfig.json b/tsconfig.json index bcbaa47..3f7f31a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,20 +1,27 @@ { // 编译选项 "compilerOptions": { + /* ES */ "target": "ESNext", // 指定ECMAScript目标版本 "module": "ESNext", // 设置程序的模块系统 "lib": ["ESNext", "DOM"], //TS需要引用的库,即声明文件,es5 默认引用dom、es5、scripthost,如需要使用es的高级版本特性,通常都需要配置,如es8的数组新特性需要引入"ES2019.Array", "skipLibCheck": true, //忽略所有的声明文件( *.d.ts)的类型检查 + + /* Bundler mode */ "moduleResolution": "bundler", //模块解析策略。默认使用node的模块解析策略 "allowImportingTsExtensions": true, // 允许导入包含 TypeScript 文档扩展名。 "resolveJsonModule": true, //允许导入扩展名为".json"的模块 "isolatedModules": true, //将每个文件作为单独的模块(与"ts.transpileModule"类似)。 "noEmit": true, // 不输出文件,即编译后不会生成任何js文件 "jsx": "preserve", //preserve模式,在preserve模式下生成代码中会保留JSX以供后续的转换操作使用 + + /* Standard */ "strict": true, //启用所有严格类型检查选项 "noUnusedLocals": true, // 若有未使用的局部变量则抛错 "noUnusedParameters": true, // 检若有未使用的函数参数则抛错 "noFallthroughCasesInSwitch": true, // 防止switch语句贯穿(即如果没有break语句后面不会执行) + + /* path */ "baseUrl": "./", // 解析非相对模块的基地址,默认是当前目录 "paths": { // 模块名到基于 baseUrl的路径映射的列表