路由

分为 视图页面。这两者配置相同,唯一的区别就是 视图 挂载在 / 路由下。

配置路由

编辑在 /@/cool/config.ts

{
    router: {
        // 模式
        mode: "history",
        // 页面
        pages: [
            {
                path: "/p1",
                name: "数据统计",
                component: () => import("/@/pages/p1.vue")
            }
        ],
        // 视图 / 路由下的 children
        views: [
            {
                path: "/v1",
                name: "数据统计",
                component: () => import("/@/views/v1.vue")
            }
        ]
    }
}

使用 history 模式时,需要服务器配置,文档地址open in new window

忽略 token

编辑在 /@/cool/config.ts

const ignore = {
	// 页面不需要登录验证
	token: ["/login", "/401", "/403", "/404", "/500", "/502"]
};

动态路由

/ 子路由都是动态加载,在 菜单列表 中配置菜单,并指向 节点路由(访问地址)文件路径(vue文件路径)

TIP

文件路径列表会自动扫描 /@/views/@/modules/**/views 下的 .{tsx|vue} 文件生成

文件路径也可以填写外部链接地址,系统会以 iframe 的方式加载

Last Updated: