comp-auth-hoc
v1.0.0
Published
basic react component
Downloads
21
Readme
comp-auth-hoc
API
| 属性 | 说明 | 类型 | 默认值 | | ---- | ---- | ---- | ---- | | children | 需要控制权限的组件 | String/ReactNode | | | rule | 当前组件具备的权限 | String | | | rules | 当前用户具备的权限列表 | Array | |
Example
import React from 'react';
import { render } from 'react-dom';
import { Button } from 'antd';
import CompAuthHOC from 'comp-auth-hoc';
render(
<div>
<CompAuthHOC rule="system:user:delete" rules={['system:user:delete', 'system:user:add']}>
<Button type="danger">Delete</Button>
</CompAuthHOC>
<CompAuthHOC rule="system:user:add" rules={['system:user:delete', 'system:user:add']}>
<Button type="primary">Add</Button>
</CompAuthHOC>
<CompAuthHOC rule="system:user:close" rules={['system:user:delete', 'system:user:add']}>
<Button type="default">Close</Button>
</CompAuthHOC>
</div>,
document.getElementById('app')
);
Development
$ npm run start
Build
$ npm run build
Publish
$ npm publish