Files
Yi.Admin/Yi.Bbs.Vue3/src/router/index.js

98 lines
2.5 KiB
JavaScript
Raw Normal View History

2023-12-14 10:15:23 +08:00
import { createRouter, createWebHistory } from "vue-router";
import Layout from "../layout/Index.vue";
import NotFound from "../views/error/404.vue";
import LoginLayout from "../layout/LoginLayout.vue";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
scrollBehavior(to, from, savedPosition) {
// 始终滚动到顶部
return { top: 0 };
},
routes: [
{
name: "test",
path: "/test",
component: () => import("../views/Test.vue"),
},
{
path: "/loginLayout",
name: "loginLayout",
component: LoginLayout,
redirect: "/login",
children: [
{
name: "login",
path: "/login",
2023-12-19 00:21:25 +08:00
// component: () => import("../views/Login.vue"),
component: () => import("../views/login/index.vue"),
2023-12-14 10:15:23 +08:00
},
{
name: "register",
path: "/register",
component: () => import("../views/Register.vue"),
},
],
},
{
path: "/",
name: "layout",
component: Layout,
redirect: "/index",
children: [
{
name: "index",
path: "/index",
component: () => import("../views/home/Index.vue"),
2023-12-17 11:57:46 +08:00
meta: {
title: "首页",
},
2023-12-14 10:15:23 +08:00
},
{
name: "article",
path: "/article/:discussId/:articleId?",
component: () => import("../views/Article.vue"),
},
{
name: "discuss",
2023-12-20 23:29:55 +08:00
path: "/discuss/:plateId?/:isPublish?",
2023-12-14 10:15:23 +08:00
component: () => import("../views/Discuss.vue"),
2023-12-17 11:57:46 +08:00
meta: {
title: "板块",
},
2023-12-14 10:15:23 +08:00
},
{
//artTypediscuss主题、article文章
//operTypecreate创建、update更新
name: "editArt",
path: "/editArt",
component: () => import("../views/EditArticle.vue"),
},
{
name: "profile",
path: "/profile",
component: () => import("../views/profile/Index.vue"),
},
2023-12-17 11:57:46 +08:00
{
name: "themeCover",
path: "/article/:discussId",
component: () => import("../views/Article.vue"),
meta: {
title: "主题封面",
},
},
2023-12-24 20:05:34 +08:00
{
name: "contact",
path: "/contact",
component: () => import("../views/contact/index.vue"),
meta: {
title: "联系我们",
},
},
2023-12-14 10:15:23 +08:00
],
},
{ path: "/:pathMatch(.*)*", name: "NotFound", component: NotFound },
],
});
export default router;