secured.md 477 Bytes
Newer Older
jim's avatar
jim committed
1
---
jim's avatar
jim committed
2
order: 3
jim's avatar
jim committed
3
title: 
jim's avatar
jim committed
4 5
  zh-CN: ζ³¨θ§£εŸΊζœ¬δ½Ώη”¨
  en-US: Basic use secured
jim's avatar
jim committed
6 7
---

jim's avatar
jim committed
8 9
secured demo used

jim's avatar
jim committed
10 11 12 13 14 15
```jsx
import RenderAuthorized from 'ant-design-pro/lib/Authorized';
import { Alert } from 'antd';

const { Secured } = RenderAuthorized('user');

jim's avatar
jim committed
16
@Secured('admin')
jim's avatar
jim committed
17 18 19 20 21 22 23 24 25 26 27 28
class TestSecuredString extends React.Component {
  render() {
    <Alert message="user Passed!" type="success" showIcon />;
  }
}
ReactDOM.render(
  <div>
    <TestSecuredString />
  </div>,
  mountNode,
);
```