chore: update docs

This commit is contained in:
vben 2024-08-01 20:58:21 +08:00
parent 4236e9cb87
commit 4a7a4f97ee
2 changed files with 74 additions and 19 deletions

View File

@ -227,6 +227,25 @@ const { hasAccessByCodes } = useAccess();
</template>
```
#### 指令方式
```vue
<template>
<Button class="mr-4" v-access:code="['AC_100100']">
Super 账号可见 ["AC_1000001"]
</Button>
<Button class="mr-4" v-access:code="['AC_100030']">
Admin 账号可见 ["AC_100010"]
</Button>
<Button class="mr-4" v-access:code="['AC_1000001']">
User 账号可见 ["AC_1000001"]
</Button>
<Button class="mr-4" v-access:code="['AC_100100', 'AC_1000001']">
Super & Admin 账号可见 ["AC_100100","AC_1000001"]
</Button>
</template>
```
### 角色
角色判断方式不需要接口返回的权限码,直接通过角色来判断按钮是否显示。
@ -272,3 +291,16 @@ const { hasAccessByRoles } = useAccess();
</Button>
</template>
```
#### 指令方式
```vue
<template>
<Button class="mr-4" v-access:role="['super']"> Super 角色可见 </Button>
<Button class="mr-4" v-access:role="['admin']"> Admin 角色可见 </Button>
<Button class="mr-4" v-access:role="['user']"> User 角色可见 </Button>
<Button class="mr-4" v-access:role="['super', 'admin']">
Super & Admin 角色可见
</Button>
</template>
```

View File

@ -1,108 +1,131 @@
---
outline: deep
---
# CLI
项目中,提供了一些命令行工具,用于一些常用的操作,代码位于 `scrips/vsh` 内。
项目中,提供了一些命令行工具,用于一些常用的操作,代码位于 `scrips` 内。
## 用法
## vsh
用于一些项目操作,如清理项目、检查项目等。
### 用法
```bash
pnpm vsh [command] [options]
```
## vsh check-circular
### vsh check-circular
检查整个项目循环引用,如果有循环引用,会在控制台输出循环引用的模块。
### 用法
#### 用法
```bash
pnpm vsh check-circular
```
### 选项
#### 选项
| 选项 | 说明 |
| ---------- | ----------------------------------- |
| `--staged` | 只检查git暂存区内的文件,默认`false` |
## vsh check-dep
### vsh check-dep
检查整个项目依赖情况,并在控制台输出`未使用的依赖`、`未安装的依赖`信息
### 用法
#### 用法
```bash
pnpm vsh check-dep
```
## vsh clean
### vsh clean
删除项目的`node_modules`、`dist`、`.turbo`等目录,清理项目。
### 用法
#### 用法
```bash
pnpm vsh clean
```
### 选项
#### 选项
| 选项 | 说明 |
| ---------------- | --------------------------------------- |
| `-r,--recursive` | 递归删除整个项目,默认`true` |
| `--del-lock` | 是否删除`pnpm-lock.yaml`文件,默认`true` |
## vsh lint
### vsh lint
对项目进行lint检查检查项目中的代码是否符合规范。
### 用法
#### 用法
```bash
pnpm vsh lint
```
### 选项
#### 选项
| 选项 | 说明 |
| ---------- | ------------------------------ |
| `--format` | 检查并尝试修复错误,默认`false` |
## vsh publint
### vsh publint
`Monorepo` 项目进行包规范检查,检查项目中的包是否符合规范。
### 用法
#### 用法
```bash
pnpm vsh publint
```
### 选项
#### 选项
| 选项 | 说明 |
| --------- | ---------------------- |
| `--check` | 仅执行检查,默认`false` |
## vsh code-workspace
### vsh code-workspace
生成 `vben-admin.code-workspace` 文件,目前不需要手动执行,会在代码提交时自动执行。
### 用法
#### 用法
```bash
pnpm vsh code-workspace
```
### 选项
#### 选项
| 选项 | 说明 |
| --------------- | -------------------------------------- |
| `--auto-commit` | `git commit`时候,自动提交,默认`false` |
| `--spaces` | 缩进格式,默认 `2`个缩进 |
## turbo-run
用于快速执行大仓中脚本,并提供选项式交互选择。
### 用法
```bash
pnpm turbo-run [command]
```
### turbo-run dev
快速执行`dev`命令,并提供选项式交互选择。