fix: 修复vue-router类型引入报错提示
This commit is contained in:
parent
7a6b607a69
commit
b8b85a582b
@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import router from "@/router/index.ts";
|
import router from "@/router/index";
|
||||||
import { RouteRecordRaw } from "vue-router";
|
import { RouteRecordRaw } from "vue-router";
|
||||||
import { getMenuListAPI } from "@/api/modules/system/index";
|
import { getMenuListAPI } from "@/api/modules/system/index";
|
||||||
import { moduleReplacement, linearArray } from "@/router/route-output";
|
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;
|
tree[0].redirect = tree[0].children[0].path;
|
||||||
// 6、动态添加路由
|
// 6、动态添加路由
|
||||||
tree.forEach((route: RouteRecordRaw) => router.addRoute(route));
|
tree.forEach((route: RouteRecordRaw) => router.addRoute(route));
|
||||||
console.log("最终路由", tree);
|
|
||||||
// 7、缓存一维路由
|
// 7、缓存一维路由
|
||||||
this.routeList = tree[0].children;
|
this.routeList = tree[0].children;
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
@ -19,4 +19,3 @@ declare module "@/directives/modules/custom";
|
|||||||
declare module "mockjs";
|
declare module "mockjs";
|
||||||
declare module "@/store/modules/route-config";
|
declare module "@/store/modules/route-config";
|
||||||
declare module "@arco-design/*";
|
declare module "@arco-design/*";
|
||||||
declare module "vue-router";
|
|
||||||
|
|||||||
@ -1,20 +1,27 @@
|
|||||||
{
|
{
|
||||||
// 编译选项
|
// 编译选项
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
/* ES */
|
||||||
"target": "ESNext", // 指定ECMAScript目标版本
|
"target": "ESNext", // 指定ECMAScript目标版本
|
||||||
"module": "ESNext", // 设置程序的模块系统
|
"module": "ESNext", // 设置程序的模块系统
|
||||||
"lib": ["ESNext", "DOM"], //TS需要引用的库,即声明文件,es5 默认引用dom、es5、scripthost,如需要使用es的高级版本特性,通常都需要配置,如es8的数组新特性需要引入"ES2019.Array",
|
"lib": ["ESNext", "DOM"], //TS需要引用的库,即声明文件,es5 默认引用dom、es5、scripthost,如需要使用es的高级版本特性,通常都需要配置,如es8的数组新特性需要引入"ES2019.Array",
|
||||||
"skipLibCheck": true, //忽略所有的声明文件( *.d.ts)的类型检查
|
"skipLibCheck": true, //忽略所有的声明文件( *.d.ts)的类型检查
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
"moduleResolution": "bundler", //模块解析策略。默认使用node的模块解析策略
|
"moduleResolution": "bundler", //模块解析策略。默认使用node的模块解析策略
|
||||||
"allowImportingTsExtensions": true, // 允许导入包含 TypeScript 文档扩展名。
|
"allowImportingTsExtensions": true, // 允许导入包含 TypeScript 文档扩展名。
|
||||||
"resolveJsonModule": true, //允许导入扩展名为".json"的模块
|
"resolveJsonModule": true, //允许导入扩展名为".json"的模块
|
||||||
"isolatedModules": true, //将每个文件作为单独的模块(与"ts.transpileModule"类似)。
|
"isolatedModules": true, //将每个文件作为单独的模块(与"ts.transpileModule"类似)。
|
||||||
"noEmit": true, // 不输出文件,即编译后不会生成任何js文件
|
"noEmit": true, // 不输出文件,即编译后不会生成任何js文件
|
||||||
"jsx": "preserve", //preserve模式,在preserve模式下生成代码中会保留JSX以供后续的转换操作使用
|
"jsx": "preserve", //preserve模式,在preserve模式下生成代码中会保留JSX以供后续的转换操作使用
|
||||||
|
|
||||||
|
/* Standard */
|
||||||
"strict": true, //启用所有严格类型检查选项
|
"strict": true, //启用所有严格类型检查选项
|
||||||
"noUnusedLocals": true, // 若有未使用的局部变量则抛错
|
"noUnusedLocals": true, // 若有未使用的局部变量则抛错
|
||||||
"noUnusedParameters": true, // 检若有未使用的函数参数则抛错
|
"noUnusedParameters": true, // 检若有未使用的函数参数则抛错
|
||||||
"noFallthroughCasesInSwitch": true, // 防止switch语句贯穿(即如果没有break语句后面不会执行)
|
"noFallthroughCasesInSwitch": true, // 防止switch语句贯穿(即如果没有break语句后面不会执行)
|
||||||
|
|
||||||
|
/* path */
|
||||||
"baseUrl": "./", // 解析非相对模块的基地址,默认是当前目录
|
"baseUrl": "./", // 解析非相对模块的基地址,默认是当前目录
|
||||||
"paths": {
|
"paths": {
|
||||||
// 模块名到基于 baseUrl的路径映射的列表
|
// 模块名到基于 baseUrl的路径映射的列表
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user