mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18: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";
|
||||
import Home from "../pages/Home.vue";
|
||||
import News from "../pages/News.vue";
|
||||
// 数据交互
|
||||
import Achievements from "../pages/Achievements.vue";
|
||||
import TPost from "../views/t-post.vue";
|
||||
// 应用配置相关
|
||||
import Config from "../pages/Config.vue";
|
||||
/**
|
||||
* @file router routes.ts
|
||||
* @description 路由配置
|
||||
* @author BTMuli<bt-muli@outlook.com>
|
||||
* @since Alpha
|
||||
*/
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "首页",
|
||||
component: Home,
|
||||
meta: {
|
||||
isMain: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
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,
|
||||
},
|
||||
},
|
||||
];
|
||||
// 主路由
|
||||
import mainRoutes from "./modules/main";
|
||||
// 子路由
|
||||
import subRoutes from "./modules/sub";
|
||||
|
||||
// 合并路由
|
||||
const routes = [...mainRoutes, ...subRoutes];
|
||||
|
||||
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