在路由router文件夹下,为菜单栏中的六个选项分别配置路由

(涉及promise类型定义,在vite-env.d.ts文件中更新promise声明)

创建views文件夹,在该文件夹下分别创建六个选项对应的文件夹,用来管理各自页面

在六个选项对应的文件夹下分别创建Index.vue文件,实现选项首页框架
pull/9/head
riverflow 2 months ago
parent 45852a18a8
commit 1c92fe013c

@ -12,7 +12,41 @@ const routes: Array<RouteRecordRaw> = [
{
path: '/home',
name: 'home', //name中home大小写错误第32次提交之前为大写
component: Layout
component: Layout,
// 添加子页面路由
children: [
{
path: '/banner',
name: 'banner',
component: () => import('@/views/banner/Index.vue')
},
{
path: '/category',
name: 'category',
component: () => import('@/views/category/Index.vue')
},
{
path: '/comment',
name: 'comment',
component: () => import('@/views/comment/Index.vue')
},
{
path: '/goods',
name: 'goods',
component: () => import('@/views/goods/Index.vue')
},
{
path: '/order',
name: 'order',
component: () => import('@/views/order/Index.vue')
},
{
path: '/user',
name: 'user',
component: () => import('@/views/user/Index.vue')
},
]
}
]

@ -8,6 +8,19 @@ interface ObjectConstructor {
entries(o: {}): [string, any][];
}
// 添加Promise方法声明
interface PromiseConstructor {
all<T>(values: Iterable<T | PromiseLike<T>>): Promise<T[]>;
race<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
resolve<T>(value?: T | PromiseLike<T>): Promise<T>;
reject<T = never>(reason?: any): Promise<T>;
any<T>(values: Iterable<T | PromiseLike<T>>): Promise<T>;
allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<T>[]>;
}
// 添加全局 Promise 声明
declare var Promise: PromiseConstructor;
// 声明 Vue 文件模块
declare module '*.vue' {
import type { DefineComponent } from 'vue'

@ -1,6 +1,7 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
//
"baseUrl": ".",
@ -10,10 +11,8 @@
]
},
//
"lib": [
"ESNext",
"DOM"
],
"lib": ["ES2015", "ES2015.Promise", "DOM", "DOM.Iterable", "ESNext"],
//
"module": "ESNext",
"moduleResolution": "Node",
@ -22,7 +21,9 @@
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
"jsx": "preserve"
"jsx": "preserve",
"downlevelIteration": true,
},
"include": [
"src/**/*.ts",

Loading…
Cancel
Save