class Page extends Component{
render() {
let hasCreatePermission = tool.getAuth("createUser");
return (
<div>
{hasCreatePermission ? <Button>创建用户</Button> : null}
</div>
);
}
}
render() {
let hasCreatePermission = tool.getAuth("createUser");
return (
<div>
{hasCreatePermission ? <Button>创建用户</Button> : <Button disabled={true}>创建用户</Button>}
</div>
);
}
render() {
let hasCreatePermission = tool.getAuth("createUser");
return (
<div>
{hasCreatePermission ? <Button>创建用户</Button> : <Button onClick={()=>alert("权限不足,请找管理员小K申请")}>创建用户</Button>}
</div>
);
}
export let wrapAuth = ComposedComponent =>class WrapComponent extends Component {
// 构造
constructor(props) {
super(props);
}
static propTypes = {
auth:PropTypes.string.isRequired,
};
render() {
if (tool.getAuth(this.props.auth)) {
return <ComposedComponent { ...this.props} />;
} else {
return null;
}
}
};
const AuthButton = wrapAuth(Button);
class Page extends Component{
render() {
return (
<div>
<AuthButton auth="createUser">创建用户</AuthButton>
</div>
);
}
}
return <ComposedComponent disabled={true} { ...this.props} />
return <ComposedComponent onClick={()=>alert("权限不足,请找管理员小K申请")} { ...this.props} />
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有