From 39f7830ddbf6c976dcf16c29d214a1cdcc2db268 Mon Sep 17 00:00:00 2001 From: jim Date: Tue, 9 Jan 2018 09:42:32 +0800 Subject: [PATCH] update Authorized doc --- src/components/Authorized/demo/basic.md | 74 ++++++------------------- src/components/Authorized/index.md | 2 +- 2 files changed, 17 insertions(+), 59 deletions(-) diff --git a/src/components/Authorized/demo/basic.md b/src/components/Authorized/demo/basic.md index a18633c4..c9694ad2 100644 --- a/src/components/Authorized/demo/basic.md +++ b/src/components/Authorized/demo/basic.md @@ -5,25 +5,6 @@ title: en-US: Basic --- -Simplest of usage. - -```jsx -import RenderAuthorized from 'ant-design-pro/lib/Authorized'; -import { Alert } from 'antd'; - -const Authorized = RenderAuthorized('user'); -const noMatch = ; - -ReactDOM.render( - - - - mountNode, -); -``` - -user Array - ```jsx import RenderAuthorized from 'ant-design-pro/lib/Authorized'; import { Alert } from 'antd'; @@ -31,54 +12,31 @@ import { Alert } from 'antd'; const Authorized = RenderAuthorized('user'); const noMatch = ; -ReactDOM.render( - - - - mountNode, -); -``` - -user Funtion - -```jsx -import RenderAuthorized from 'ant-design-pro/lib/Authorized'; -import { Alert } from 'antd'; - -const Authorized = RenderAuthorized('user'); -const noMatch = ; -const Havepermission = () => { +const havePermission = () => { return false; }; -ReactDOM.render( - - - - mountNode, -); -``` - - -user Promise - -```jsx -import RenderAuthorized from 'ant-design-pro/lib/Authorized'; -import { Alert } from 'antd'; - -const Authorized = RenderAuthorized('user'); -const noMatch = ; - -const Havepermission = new Promise((reslove,reject)=>{ +const havePermissionAsync = new Promise((resolve,reject)=>{ // Call reslove on behalf of passed setTimeout(()=>reslove(),1000) }); ReactDOM.render( - - - +
+ + + + + + + + + + + + +
mountNode, ); ``` diff --git a/src/components/Authorized/index.md b/src/components/Authorized/index.md index c53be7b8..1fe99615 100644 --- a/src/components/Authorized/index.md +++ b/src/components/Authorized/index.md @@ -48,7 +48,7 @@ order: 15 ### Authorized.check 函数形式的 Authorized,用于某些不能被 HOC 包裹的组件。 `Authorized.check(authority, target, Exception)` -注意:传入一个Promise时 无论正确还是错误返回的都是一个ReactNode. +注意:传入一个 Promise 时,无论正确还是错误返回的都是一个 ReactClass。 | 参数 | 说明 | 类型 | 默认值 | |----------|------------------------------------------|-------------|-------| -- GitLab