secured.md 497 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
class TestSecuredString extends React.Component {
  render() {
luker's avatar
luker committed
19
    return (
chen shuai's avatar
chen shuai committed
20
      <Alert message="user Passed!" type="success" showIcon />
luker's avatar
luker committed
21
    )
jim's avatar
jim committed
22 23 24 25 26 27 28 29 30
  }
}
ReactDOM.render(
  <div>
    <TestSecuredString />
  </div>,
  mountNode,
);
```