♻️ 路由按需引入

This commit is contained in:
BTMuli
2023-07-18 21:54:13 +08:00
parent cb98a236c6
commit 07bc93ab39
4 changed files with 29 additions and 66 deletions

View File

@@ -1,45 +1,35 @@
/**
* @file router modules main.ts
* @description 主路由模块
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.6
* @author BTMuli <bt-muli@outlook.com>
* @since Alpha v0.2.2
*/
// 信息展示
import Announcements from "../../pages/Announcements.vue";
import Home from "../../pages/Home.vue";
// 数据交互
import Achievements from "../../pages/Achievements.vue";
// 应用配置相关
import Config from "../../pages/Config.vue";
// 测试页
import Test from "../../pages/Test.vue";
const mainRoutes = [
{
path: "/",
name: "首页",
component: Home,
component: async () => await import("../../pages/Home.vue"),
},
{
path: "/test",
name: "测试页",
component: Test,
component: async () => await import("../../pages/Test.vue"),
},
{
path: "/achievements",
name: "成就",
component: Achievements,
component: async () => await import("../../pages/Achievements.vue"),
},
{
path: "/announcements",
name: "公告",
component: Announcements,
component: async () => await import("../../pages/Announcements.vue"),
},
{
path: "/config",
name: "设置",
component: Config,
component: async () => await import("../../pages/Config.vue"),
},
{
path: "/home",

View File

@@ -1,50 +1,40 @@
/**
* @file router modules sub.ts
* @description 子路由模块,用于二级窗口
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.2
* @author BTMuli <bt-muli@outlook.com>
* @since Alpha v0.2.2
*/
// 游戏内公告
import TAnno from "../../views/t-anno.vue";
import TAnnoJson from "../../views/t-anno-json.vue";
// 咨讯
import TNews from "../../views/t-news.vue";
// 帖子相关
import TPost from "../../views/t-post.vue";
import TPostJson from "../../views/t-post-json.vue";
// 抽奖
import TLottery from "../../views/t-lottery.vue";
const subRoutes = [
{
path: "/anno_detail/:anno_id",
name: "游戏内公告",
component: TAnno,
component: async () => await import("../../views/t-anno.vue"),
},
{
path: "/anno_detail_json/:anno_id",
name: "游戏内公告JSON",
component: TAnnoJson,
component: async () => await import("../../views/t-anno-json.vue"),
},
{
path: "/news/:gid",
name: "咨讯",
component: TNews,
component: async () => await import("../../views/t-news.vue"),
},
{
path: "/post_detail/:post_id",
name: "帖子详情",
component: TPost,
component: async () => await import("../../views/t-post.vue"),
},
{
path: "/post_detail_json/:post_id",
name: "帖子详情JSON",
component: TPostJson,
component: async () => await import("../../views/t-post-json.vue"),
},
{
path: "/lottery/:lottery_id",
name: "抽奖详情",
component: TLottery,
component: async () => await import("../../views/t-lottery.vue"),
},
];

View File

@@ -1,37 +1,30 @@
/**
* @file router modules user.ts
* @description user 路由模块
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.2.0
* @author BTMuli <bt-muli@outlook.com>
* @since Alpha v0.2.2
*/
// user main
import Abyss from "../../pages/User/Abyss.vue";
import Characters from "../../pages/User/Characters.vue";
import Gacha from "../../pages/User/Gacha.vue";
import Record from "../../pages/User/Record.vue";
// user sub
const userRoutes = [
{
path: "/user/abyss",
name: "深渊记录",
component: Abyss,
component: async () => await import("../../pages/User/Abyss.vue"),
},
{
path: "/user/characters",
name: "我的角色",
component: Characters,
component: async () => await import("../../pages/User/Characters.vue"),
},
{
path: "/user/gacha",
name: "祈愿记录",
component: Gacha,
component: async () => await import("../../pages/User/Gacha.vue"),
},
{
path: "/user/record",
name: "原神战绩",
component: Record,
component: async () => await import("../../pages/User/Record.vue"),
},
];

View File

@@ -2,54 +2,44 @@
* @file router modules wiki.ts
* @description wiki 路由模块
* @author BTMuli <bt-muli@outlook.com>
* @since Alpha v0.2.1
* @since Alpha v0.2.2
*/
// Wiki main
import Abyss from "../../pages/WIKI/Abyss.vue";
import Character from "../../pages/WIKI/Character.vue";
import GCG from "../../pages/WIKI/GCG.vue";
import Weapon from "../../pages/WIKI/Weapon.vue";
// Wiki sub
import TCharacter from "../../views/WIKI/t-character.vue";
import TGCG from "../../views/WIKI/t-gcg.vue";
import TWeapon from "../../views/WIKI/t-weapon.vue";
const wikiRoutes = [
{
path: "/wiki/abyss",
name: "深渊数据库",
component: Abyss,
component: async () => await import("../../pages/WIKI/Abyss.vue"),
},
{
path: "/wiki/character",
name: "角色图鉴",
component: Character,
component: async () => await import("../../pages/WIKI/Character.vue"),
},
{
path: "/wiki/GCG",
name: "卡牌图鉴",
component: GCG,
component: async () => await import("../../pages/WIKI/GCG.vue"),
},
{
path: "/wiki/weapon",
name: "武器图鉴",
component: Weapon,
component: async () => await import("../../pages/WIKI/Weapon.vue"),
},
{
path: "/wiki/detail/character/:id",
name: "角色详情",
component: TCharacter,
component: async () => await import("../../views/WIKI/t-character.vue"),
},
{
path: "/wiki/detail/GCG/:id",
name: "卡牌详情",
component: TGCG,
component: async () => await import("../../views/WIKI/t-gcg.vue"),
},
{
path: "/wiki/detail/weapon/:id",
name: "武器详情",
component: TWeapon,
component: async () => await import("../../views/WIKI/t-weapon.vue"),
},
];