mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-08 18:34:44 +08:00
docs: 更新路由文档
This commit is contained in:
@@ -16,34 +16,58 @@ OpenAuth.Pro采用的是标准vue router来管理页面跳转,基础知识请
|
||||
|
||||
|
||||
在有些场景下,不想通过系统的【模块管理】功能添加页面,如登录、注册、帮助中心、站点介绍等,可以在路由表中直接添加。
|
||||
打开`src\router\index.js`,在数组常量`constantRouterMap`中添加自己的路由信息:
|
||||
打开`src\router\modules\home.js`添加自己的路由信息:
|
||||
|
||||
```javascript
|
||||
{
|
||||
path: '/regster',
|
||||
name: 'regster',
|
||||
hidden: true, //是否在左侧导航栏隐藏
|
||||
meta: {
|
||||
title: '仓储中心',
|
||||
icon: 'guide',
|
||||
sortNo: 0
|
||||
{
|
||||
path: '/redirect',
|
||||
component: Layout,
|
||||
name: 'redirect',
|
||||
hidden: true, //是否在左侧导航栏隐藏
|
||||
meta: {
|
||||
title: '外部页面',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'iframe',
|
||||
hidden: true,
|
||||
name: 'iframe',
|
||||
component: IframeView,
|
||||
meta: {
|
||||
title: '外部页面',
|
||||
id: 'iframe',
|
||||
},
|
||||
},
|
||||
component: () => import('@/views/regster/index') //路由对应的页面视图
|
||||
}
|
||||
],
|
||||
},
|
||||
|
||||
```
|
||||
|
||||
因为注册页面没有登录的用户信息,会被系统的权限体系拦截从而跳转到登录页面。需要添加到白名单中。
|
||||
打开`src\permission.js`,在`whiteList`中加入刚刚的路由信息:
|
||||
上面会添加一个带有layout的页面(即有顶部、左侧导航栏、面包屑等区域),如果不想使用layout,可以参考:
|
||||
|
||||
```javascript
|
||||
{
|
||||
path: '/wmsinboundordertbls/detail/:id',
|
||||
component: DetailWmsInboundOrderTbls,
|
||||
name: 'wmsinboundordertbls',
|
||||
hidden: true,
|
||||
meta: {
|
||||
notauth: true,
|
||||
title: '入库单详情',
|
||||
noCache: true,
|
||||
icon: 'list',
|
||||
}
|
||||
}
|
||||
```
|
||||
这种页面没有顶部、左侧导航栏、面包屑等区域,方便作为组件嵌入到其他页面中。
|
||||
|
||||
部分页面访问的时候,可能没有登录的用户信息,比如:用户注册页面等。会被系统的权限体系拦截从而跳转到登录页面。需要添加到白名单中。
|
||||
打开`src\permission.js`,在`whiteList`中加入刚刚的路由信息:
|
||||
|
||||
```javascript
|
||||
const whiteList = ['/regster', ...] // 不重定向白名单
|
||||
|
||||
```
|
||||
|
||||
添加完成后,启动站点,直接浏览器访问`http://localhost:1803/#/regster`即可:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user