fix: 修复vue-router类型引入报错提示

This commit is contained in:
WANGFAN\wangf 2024-12-03 15:01:03 +08:00
parent 7a6b607a69
commit b8b85a582b
3 changed files with 8 additions and 3 deletions

View File

@ -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;
}

1
src/vite-env.d.ts vendored
View File

@ -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";

View File

@ -1,20 +1,27 @@
{
//
"compilerOptions": {
/* ES */
"target": "ESNext", // ECMAScript
"module": "ESNext", //
"lib": ["ESNext", "DOM"], //TSes5 domes5scripthost,使eses8"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,preserveJSX使
/* Standard */
"strict": true, //
"noUnusedLocals": true, // 使
"noUnusedParameters": true, // 使
"noFallthroughCasesInSwitch": true, // switch穿(break)
/* path */
"baseUrl": "./", //
"paths": {
// baseUrl