react-authority

1.0.4 • Public • Published

react-authority

install

$ npm install react-authority --save-dev

usage

import React, { Component } from 'react';
import ReactDom from 'react-dom';
import ReactAuthority from 'react-authority';
 
ReactDOM.render((
  <ReactAuthority code="create" permission={['create']}>
    <button>创建</button>
  </ReactAuthority>
), document.getElementById('root'));
 
ReactDOM.render((
  <ReactAuthority code="detail" permission={['create']}>
    <ReactAuthority.Admit>
      <a href="url-to-detail">查看详情</a>
    </ReactAuthority.Admit>
    <ReactAuthority.Deny>
      没有查看权限,没有链接
    </ReactAuthority.Deny>
  </ReactAuthority>
), document.getElementById('root'));

Readme

Keywords

Package Sidebar

Install

npm i react-authority

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

80.7 kB

Total Files

6

Last publish

Collaborators

  • leeqq