From 6c94fc1fe2c4162d905f6ddeeef97a9bb435b6e7 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Thu, 28 Feb 2019 13:36:32 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AuthorityControl/demo/demo.md | 15 +++++++++++++++ .../components/AuthorityControl/index.d.ts | 7 +++++++ .../src/components/AuthorityControl/index.js | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 admin-web/src/components/AuthorityControl/demo/demo.md create mode 100644 admin-web/src/components/AuthorityControl/index.d.ts create mode 100644 admin-web/src/components/AuthorityControl/index.js diff --git a/admin-web/src/components/AuthorityControl/demo/demo.md b/admin-web/src/components/AuthorityControl/demo/demo.md new file mode 100644 index 000000000..bf77f3462 --- /dev/null +++ b/admin-web/src/components/AuthorityControl/demo/demo.md @@ -0,0 +1,15 @@ + +--- + +使用 demo + + +authKey: 代表key的权限 + +--- + +```jsx harmony + + + +``` diff --git a/admin-web/src/components/AuthorityControl/index.d.ts b/admin-web/src/components/AuthorityControl/index.d.ts new file mode 100644 index 000000000..b54342194 --- /dev/null +++ b/admin-web/src/components/AuthorityControl/index.d.ts @@ -0,0 +1,7 @@ +import * as React from 'react'; + +export interface AuthorityControlProps { + authKey: string; +} + +export default class LoginItem extends React.Component {} diff --git a/admin-web/src/components/AuthorityControl/index.js b/admin-web/src/components/AuthorityControl/index.js new file mode 100644 index 000000000..3f5a404c2 --- /dev/null +++ b/admin-web/src/components/AuthorityControl/index.js @@ -0,0 +1,19 @@ +import React, { PureComponent } from 'react'; +import GlobalAuthority from '../../layouts/GlobalAuthority'; + +// 用于控制权限 +class AuthorityControl extends PureComponent { + render() { + const { authKey, children } = this.props; + return ( + + {context => { + const { authList } = context; + return
{authList[authKey] ? children : '无权限'}
; + }} +
+ ); + } +} + +export default AuthorityControl;