diff --git a/src/router/modules/main.ts b/src/router/modules/main.ts new file mode 100644 index 00000000..62e1d2f4 --- /dev/null +++ b/src/router/modules/main.ts @@ -0,0 +1,49 @@ +/** + * @file router modules main.ts + * @description 主路由模块 + * @author BTMuli + * @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; diff --git a/src/router/modules/sub.ts b/src/router/modules/sub.ts new file mode 100644 index 00000000..bd79c8ee --- /dev/null +++ b/src/router/modules/sub.ts @@ -0,0 +1,24 @@ +/** + * @file router modules sub.ts + * @description 子路由模块,用于二级窗口 + * @author BTMuli + * @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; diff --git a/src/router/routes.ts b/src/router/routes.ts index b6347463..434b5e6a 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -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 + * @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; diff --git a/src/views/t-post-json.vue b/src/views/t-post-json.vue new file mode 100644 index 00000000..6242516a --- /dev/null +++ b/src/views/t-post-json.vue @@ -0,0 +1,2 @@ + +