自动路由-bug版
This commit is contained in:
@ -1,100 +1,21 @@
|
||||
import { createRouter, createWebHistory } from "vue-router";
|
||||
|
||||
import layout from "@/Layout.vue";
|
||||
import Home from '@/views/Home.vue';
|
||||
import { routes } from 'vue-router/auto-routes';
|
||||
// import layout from "@/Layout.vue";
|
||||
// import Home from '@/views/Home.vue';
|
||||
|
||||
// 导入视图组件 - 修改为@开头的懒加载路径
|
||||
|
||||
const Gallery = () => import("@/views/Gallery.vue");
|
||||
const Article = () => import("@/views/Article.vue");
|
||||
const Widget = () => import("@/views/Widget.vue");
|
||||
const AppShare = () => import("@/views/AppShare.vue");
|
||||
const Plink = () => import("@/views/Plink.vue");
|
||||
const Login = () => import("@/views/login/Login.vue");
|
||||
const NotFound = () => import("@/views/NotFound.vue");
|
||||
// const Gallery = () => import("@/views/Gallery.vue");
|
||||
// const Article = () => import("@/views/Article.vue");
|
||||
// const Widget = () => import("@/views/Widget.vue");
|
||||
// const AppShare = () => import("@/views/AppShare.vue");
|
||||
// const Plink = () => import("@/views/Plink.vue");
|
||||
// const Login = () => import("@/views/Login.vue");
|
||||
// const NotFound = () => import("@/views/NotFound.vue");
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
|
||||
meta: {},
|
||||
children: [
|
||||
{
|
||||
path: "/",
|
||||
component: layout,
|
||||
redirect: {name:'home'},
|
||||
children: [
|
||||
{
|
||||
path: "/home",
|
||||
name: "home",
|
||||
component: Home,
|
||||
meta: {
|
||||
title:'首页'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/gallery",
|
||||
name: "gallery",
|
||||
component: Gallery,
|
||||
meta: {
|
||||
title:'画廊'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/article",
|
||||
name: "article",
|
||||
component: Article,
|
||||
meta: {
|
||||
title:'文章'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/widget",
|
||||
name: "widget",
|
||||
component: Widget,
|
||||
meta: {
|
||||
title:'工具'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/appshare",
|
||||
name: "appShare",
|
||||
component: AppShare,
|
||||
meta: {
|
||||
title:'软件分享'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/plink",
|
||||
name: "plink",
|
||||
component: Plink,
|
||||
meta: {
|
||||
title:'友链'
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "login",
|
||||
component: Login,
|
||||
meta: {
|
||||
title:'登录'
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/404",
|
||||
name: "404",
|
||||
component: NotFound,
|
||||
meta: {
|
||||
title:'错误页'
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
routes:routes as any
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user