mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
fix(route): 路由分离
This commit is contained in:
49
src/router/modules/main.ts
Normal file
49
src/router/modules/main.ts
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* @file router modules main.ts
|
||||||
|
* @description 主路由模块
|
||||||
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
|
* @since Alpha
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 信息展示
|
||||||
|
import Home from "../../pages/Home.vue";
|
||||||
|
import News from "../../pages/News.vue";
|
||||||
|
import GCG from "../../pages/GCG.vue";
|
||||||
|
// 数据交互
|
||||||
|
import Achievements from "../../pages/Achievements.vue";
|
||||||
|
// 应用配置相关
|
||||||
|
import Config from "../../pages/Config.vue";
|
||||||
|
|
||||||
|
const mainRoutes = [
|
||||||
|
{
|
||||||
|
path: "/",
|
||||||
|
name: "首页",
|
||||||
|
component: Home,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/achievements",
|
||||||
|
name: "成就",
|
||||||
|
component: Achievements,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/config",
|
||||||
|
name: "设置",
|
||||||
|
component: Config,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/GCG",
|
||||||
|
name: "卡牌",
|
||||||
|
component: GCG,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/home",
|
||||||
|
redirect: "/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/news",
|
||||||
|
name: "咨讯",
|
||||||
|
component: News,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default mainRoutes;
|
||||||
24
src/router/modules/sub.ts
Normal file
24
src/router/modules/sub.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* @file router modules sub.ts
|
||||||
|
* @description 子路由模块,用于二级窗口
|
||||||
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
|
* @since Alpha
|
||||||
|
*/
|
||||||
|
// 帖子相关
|
||||||
|
import TPost from "../../views/t-post.vue";
|
||||||
|
import TPostJson from "../../views/t-post-json.vue";
|
||||||
|
|
||||||
|
const subRoutes = [
|
||||||
|
{
|
||||||
|
path: "/post_detail/:post_id",
|
||||||
|
name: "帖子详情",
|
||||||
|
component: TPost,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/post_detail_json/:post_id",
|
||||||
|
name: "帖子详情(JSON)",
|
||||||
|
component: TPostJson,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default subRoutes;
|
||||||
@@ -1,69 +1,16 @@
|
|||||||
// 信息展示
|
/**
|
||||||
import GCG from "../pages/GCG.vue";
|
* @file router routes.ts
|
||||||
import Home from "../pages/Home.vue";
|
* @description 路由配置
|
||||||
import News from "../pages/News.vue";
|
* @author BTMuli<bt-muli@outlook.com>
|
||||||
// 数据交互
|
* @since Alpha
|
||||||
import Achievements from "../pages/Achievements.vue";
|
*/
|
||||||
import TPost from "../views/t-post.vue";
|
|
||||||
// 应用配置相关
|
|
||||||
import Config from "../pages/Config.vue";
|
|
||||||
|
|
||||||
const routes = [
|
// 主路由
|
||||||
{
|
import mainRoutes from "./modules/main";
|
||||||
path: "/",
|
// 子路由
|
||||||
name: "首页",
|
import subRoutes from "./modules/sub";
|
||||||
component: Home,
|
|
||||||
meta: {
|
// 合并路由
|
||||||
isMain: true,
|
const routes = [...mainRoutes, ...subRoutes];
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/achievements",
|
|
||||||
name: "成就",
|
|
||||||
component: Achievements,
|
|
||||||
meta: {
|
|
||||||
isMain: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/config",
|
|
||||||
name: "设置",
|
|
||||||
component: Config,
|
|
||||||
meta: {
|
|
||||||
isMain: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/GCG",
|
|
||||||
name: "卡牌",
|
|
||||||
component: GCG,
|
|
||||||
meta: {
|
|
||||||
isMain: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/home",
|
|
||||||
redirect: "/",
|
|
||||||
meta: {
|
|
||||||
isMain: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/news",
|
|
||||||
name: "咨讯",
|
|
||||||
component: News,
|
|
||||||
meta: {
|
|
||||||
isMain: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "/post_detail/:post_id",
|
|
||||||
name: "帖子详情",
|
|
||||||
component: TPost,
|
|
||||||
meta: {
|
|
||||||
isMain: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default routes;
|
export default routes;
|
||||||
|
|||||||
2
src/views/t-post-json.vue
Normal file
2
src/views/t-post-json.vue
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<template></template>
|
||||||
|
<script lang="ts"></script>
|
||||||
Reference in New Issue
Block a user