- 添加菜单权限控制

- url 权限控制
This commit is contained in:
sin
2019-03-01 18:15:12 +08:00
parent 814ca633aa
commit 21bacc19d8
14 changed files with 160 additions and 23 deletions

View File

@@ -1,17 +1,17 @@
import React, { PureComponent } from 'react';
import GlobalAuthority from '../../layouts/GlobalAuthorityContext';
import UrlsContext from '../../layouts/UrlsContext';
// 用于控制权限
class AuthorityControl extends PureComponent {
render() {
const { authKey, children } = this.props;
return (
<GlobalAuthority.Consumer>
<UrlsContext.Consumer>
{context => {
const { authList } = context;
return <div>{authList[authKey] ? children : '无权限'}</div>;
}}
</GlobalAuthority.Consumer>
</UrlsContext.Consumer>
);
}
}