Awesome Open Source
Awesome Open Source

React Admin Template

/

  • TypeScript: JavaScript
  • **** Ant Design
  • **** React/umi/antd

  • **Mock **


 config                     # umi 
 docker                     # docker 
 mock                       # 
 public                     # 
 src                        # 
    assets                 # 
    common                 # 
    components             # 
    config                 # 
    layouts                # 
    locales                # 
    models                 # 
    pages                  # 
    services               # 
    utils                  # 
    app.tsx                # 
    authority.ts           # 
    global.less            # 
    typings.d.ts           # 
 package.json               # package.json
 tsconfig.json              # tsconfig.json

umi-plugin-authority useAuthority hooks Authority

import React from 'react';
import { useAuthority, Authority } from 'umi';

const PageA = props => {
  const { foo } = props;
  const { combinationVerify } = useAuthority();
 
  //  hooks   
  if (combinationVerify('module1/action1')) {
    //  module1/action1 ...
  }
  
  return (
    <div>
      {/**  */}
      <Authority
        access="module1/action1"
        fallback={<div>Can not read foo content.</div>}
      >
        Foo content.
      </Authority>
      {/**  */}
      <Authority
        accessible={combinationVerify('module1/action1')}
        fallback={<div>Can not update foo.</div>}
      >
        Update foo.
      </Access>
      {/**  */}
      <Authority
        accessible={combinationVerify('(module1/action1 || module1/action2) && module1/action3')}
        fallback={<div>Can not update foo.</div>}
      >
        Update foo.
      </Access>
      {/** children function */}
      <Authority
        accessible={combinationVerify('module3/action1')}
        fallback={<div>Can not delete foo.</div>}
      >
        {(isMatch) => <span>: {isMatch}</span>}
      </Authority>
    </div>
  );
};

# 
git clone [email protected]:ts-react/react-admin-template.git

# 
cd ./react-admin-template

# 
yarn

# 
npm run start

IE11

IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari OperaOpera
IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

Github Issue
issues

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Typescript (251,857
Reactjs (72,668
Less (1,793
Admin (1,488
Ant Design (883
Single Page App (662
Admin Template (265
Umi (197
Related Projects