add 权限控制:对对“删除”按钮的权限控制

master
18229333266 5 years ago
parent db140029cf
commit 850eb00ee5

@ -19,6 +19,7 @@ import {
import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import styles from './BasicList.less'; import styles from './BasicList.less';
import Authorized from '../../utils/Authorized';
const RadioButton = Radio.Button; const RadioButton = Radio.Button;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
@ -89,7 +90,9 @@ export default class BasicList extends PureComponent {
<a>编辑</a> <a>编辑</a>
</Menu.Item> </Menu.Item>
<Menu.Item> <Menu.Item>
<Authorized authority="admin" >
<a>删除</a> <a>删除</a>
</Authorized>
</Menu.Item> </Menu.Item>
</Menu> </Menu>
); );

@ -1,6 +1,7 @@
import RenderAuthorized from '../components/Authorized'; import RenderAuthorized from '../components/Authorized';
import { getAuthority } from './authority'; import { getAuthority } from './authority';
// 权限组件默认 export RenderAuthorized 函数,它接收当前权限作为参数,返回一个权限对象
let Authorized = RenderAuthorized(getAuthority()); // eslint-disable-line let Authorized = RenderAuthorized(getAuthority()); // eslint-disable-line
// Reload the rights component // Reload the rights component

Loading…
Cancel
Save