mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
feat(tree): add check-strategy prop (#1122)
* docs(tree): add checkStrategy prop * docs(tree): add log * feat(n-tree): 属性更新 * feat(n-tree): update the description of docs Co-authored-by: unknown <liyang@xiaoyouzi.com>
This commit is contained in:
parent
ff13ab6997
commit
70a669a86d
@ -1,5 +1,9 @@
|
||||
# CHANGELOG
|
||||
|
||||
### Feats
|
||||
|
||||
- `n-tree` add `check-strategy` document prop.
|
||||
|
||||
## 2.18.1 (2021-09-08)
|
||||
|
||||
### Feats
|
||||
|
@ -1,5 +1,9 @@
|
||||
# CHANGELOG
|
||||
|
||||
### Feats
|
||||
|
||||
- `n-tree` 增加 `check-strategy` 文档属性
|
||||
|
||||
## 2.18.1 (2021-09-08)
|
||||
|
||||
### Feats
|
||||
|
@ -749,7 +749,7 @@ export default defineComponent({
|
||||
checkedKeys={this.treeCheckedKeys}
|
||||
selectedKeys={this.treeSelectedKeys}
|
||||
checkable={checkable}
|
||||
internalCheckStrategy={this.checkStrategy}
|
||||
checkStrategy={this.checkStrategy}
|
||||
cascade={this.mergedCascade}
|
||||
leafOnly={this.leafOnly}
|
||||
multiple={this.multiple}
|
||||
|
@ -31,6 +31,7 @@ batch-render
|
||||
| block-node | `boolean` | `false` | The node name is spread out in the whole row. |
|
||||
| cancelable | `boolean` | `true` | Whether node's select status can be cancelled. |
|
||||
| cascade | `boolean` | `false` | Whether to cascade checkboxes. |
|
||||
| check-strategy | `string` | `'all'` | The way to set the value of callback function. `all` means setting all checked node. `parent` means setting all checked parent node when all child node are checked. `child` means setting all child node. |
|
||||
| checkable | `boolean` | `false` | Whether to display the selection box, you need to set `cascade` to `true`. |
|
||||
| children-field | `string` | `'children'` | The children field in `TreeOption`. |
|
||||
| checked-keys | `Array<string \| number>` | `undefined` | If set, checked status will work in controlled manner. |
|
||||
|
@ -31,6 +31,7 @@ batch-render
|
||||
| block-node | `boolean` | `false` | 节点名称整行撑开 |
|
||||
| cancelable | `boolean` | `true` | 选中之后是否允许取消 |
|
||||
| cascade | `boolean` | `false` | 是否关联选项 |
|
||||
| check-strategy | `string` | `'all'` | 设置勾选策略来指定回调参数的值,`all` 表示回调函数值为全部选中节点;`parent` 表示回调函数值为父节点(当父节点下所有子节点都选中时);`child` 表示回调函数值为子节点 |
|
||||
| checkable | `boolean` | `false` | 是否显示选择框,需要将 `cascade` 设置为 `true` |
|
||||
| children-field | `string` | `'children'` | 替代 `TreeOption` 中的 children 字段名 |
|
||||
| checked-keys | `Array<string \| number>` | `undefined` | 如果设定则 `checked` 状态受控 |
|
||||
|
@ -213,7 +213,7 @@ const treeProps = {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
internalCheckStrategy: {
|
||||
checkStrategy: {
|
||||
type: String as PropType<CheckStrategy>,
|
||||
default: 'all'
|
||||
}
|
||||
@ -269,7 +269,7 @@ export default defineComponent({
|
||||
})
|
||||
})
|
||||
const mergedCheckStrategyRef = computed(() =>
|
||||
props.leafOnly ? 'child' : props.internalCheckStrategy
|
||||
props.leafOnly ? 'child' : props.checkStrategy
|
||||
)
|
||||
const displayedCheckedKeysRef = computed(() => {
|
||||
return checkedStatusRef.value.checkedKeys
|
||||
|
Loading…
Reference in New Issue
Block a user