- 添加菜单权限控制
- url 权限控制
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user