BranchItem
说明
- 分支列表里面的分支卡片信息
import { mock } from 'mockjs';
// 数据定义为 @/components/BranchItem/type.ts
const branch = ref({
name: mock('@word'),
behindCount: mock('@natural(0, 500)'),
aheadCount: mock('@natural(0, 500)'),
repo: {
name: mock('@word'),
namespace: mock('@first')
},
lastCommit: {
id: mock('@id'),
message: mock('@paragraph'),
username: mock('@first'),
createTime: mock('@datetime')
}
});
// 此处使用v-bind统一prop,可以分开传入,如 <BranchItem :name="xxx" ...... />
<BranchItem v-bind="branch" />
Props
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| name | 分支名称 | string | - | - |
| behindCount | 落后默认分支commit个数 | number | - | - |
| aheadCount | 领先默认分支commit个数 | number | - | - |
| repo | 分支所属的仓库信息 | Repo | - | - |
| lastCommit | 分支下的最后一次commit | Commit | - | - |
Repo
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| name | 仓库名称 | string | - | - |
| namespace | 仓库所属命名空间(用户或组织的namespace) | string | - | - |
Commit
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| id | commit的hash Id | string | - | - |
| message | 提交描述 | string | - | - |
| username | commit提交人 | string | - | - |
| createTime | 提交时间 | string | - | - |
Emits
| 方法 | 说明 | 返回值 |
|---|---|---|
| onView | 查看分支统计 | props整体数据 |
| onEdit | 编辑分支事件 | props整体数据 |
| onDelete | 删除分支事件 | props整体数据 |