This commit is contained in:
路 范
2021-09-24 14:33:10 +08:00
parent 0e82fb3156
commit c03092bc0c
432 changed files with 57806 additions and 4 deletions

View File

@@ -0,0 +1,51 @@
import { Auth } from 'components'
import auth from 'components/authorized/handler'
/**
* 简单的权限标识
*/
function foo1() {
return (
<Auth auth="permissions:name">
<a>连接</a>
</Auth>
)
}
/**
* 多个并且关系的权限标识
*/
function foo2() {
return (
<Auth auth={['permissions:name1', 'permissions:name2']}>
<a>连接</a>
</Auth>
)
}
/**
* 多个或者关系的权限标识
*/
function foo3() {
return (
<Auth auth={[['permissions:name1'], ['permissions:name2']]}>
<a>连接</a>
</Auth>
)
}
/**
* 前缀简化
*/
function foo4() {
return (
<Auth auth={{ permissions: ['name1', 'name2'] }}>
<a>连接</a>
</Auth>
)
}
/**
* 纯js
*/
const flag = auth('permissions:name') // => Boolean