--- order: 1 title: zh-CN: 注解 en-US: secured --- ```jsx import RenderAuthorized from 'ant-design-pro/lib/Authorized'; import { Alert } from 'antd'; const { Secured } = RenderAuthorized('user'); const noMatch = ; const havePermission = () => { return false; }; const havePermissionAsync = new Promise((resolve, reject) => { // Call reslove on behalf of passed setTimeout(() => reslove(), 1000); }); @Secured('admin', noMatch) class TestSecuredString extends React.Component { render() { ; } } @Secured(['user', 'admin'], noMatch) class TestSecuredArray extends React.Component { render() { ; } } @Secured(havePermission, noMatch) class TestSecuredFunction extends React.Component { render() { ; } } @Secured(havePermissionAsync, noMatch) class TestSecuredPromise extends React.Component { render() { ; } } ReactDOM.render(
, mountNode, ); ```