import React , { useEffect , useState } from "react" ; import type { IAuthorityType } from "./checkPermissions" ; import checkPermissions from "./checkPermissions" ; interface AuthorizedProps { authority : IAuthorityType ; render ? : ( ) => React . ReactNode ; noMatch ? : React . ReactNode ; children ? : React . ReactNode ; } /**
 * 按钮权限判定
 */ function AuthorizedButton ( { children , authority , render , noMatch , } ) { const [ permissions ] = useState < string [ ] > ( [ "button" , "button1" , "button2" ] ) ; const result = checkPermissions ( authority , permissions , render ? render ( ) : children , noMatch ) ; return < > { result } < />; } export default React . memo ( AuthorizedButton ) ;