You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
517 B

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