LANIF-UI / dva-boot-admin

:cake: react admin dashboard ui LANIF-ADMIN --- react 16 + react-router 4 + dva 2 + antd 4 后台管理 脚手架
https://lanif-ui.github.io/dva-boot-admin
MIT License
1.67k stars 460 forks source link

如何加权限 #115

Open songyanbo opened 3 years ago

songyanbo commented 3 years ago

可以参考ant-design-pro的权限,只需要在utils/core.js做如下更改即可实现,还有记得在具体的页面路由配置中增加authority: ['admin'],代码如下: `import React from 'react'; import dynamic from 'dva/dynamic'; import { Route, Switch, Redirect } from 'dva/router'; import DocumentTitle from 'react-document-title'; import assign from 'object-assign'; import $$ from 'cmn-utils'; import config from '@/config'; import Authorized from '../utils/Authorized'; const { AuthorizedRoute } = Authorized;

/**

/**

const routesConfig = app => ({ path: '/myproject', title: '我的项目', component: dynamicWrapper(app, [import('./model')], () => import('./components')), exact: true, authority: ['admin','audit'], });

export default app => createRoute(app, routesConfig); `