2020-08-13 11:47:56 +08:00
# RegionPicker
## Demos
[[ demo src="/demo/region-picker/default.vue" ]]
## API
### Props
| Name | Type | Default | Description |
| -- | -- | -- | -- |
2021-10-20 01:11:27 +08:00
| ``datasource`` | `Array<Object>` | `[]` | [^datasource] |
| ``selected`` | `Array<string>` | - | [^selected] |
| ``include-indeterminate`` | `boolean` | `false` | Whether to include indeterminate node into selected nodes. Non-leaf nodes inside `datasource` will be in indeterminate state if their descendant nodes are partially selected. |
| ``disabled`` | `boolean=` | `false` | Whether the region picker is disabled. |
| ``readonly`` | `boolean=` | `false` | Whether the region picker is read-only. |
2020-08-13 11:47:56 +08:00
^^^datasource
The datasource of the region picker. The type of node item is `{label, value, disabled, children, ...}` .
+++Properties
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the node. |
| `value` | `string` | The value of the node. |
| `disabled` | `boolean=` | Whether the node is disabled. |
| `children` | `Array<Object>=` | The child nodes of the node. The node type is the same as `datasource` items. |
+++
^^^
^^^selected
:::badges
`v-model`
:::
The array of selected `value` s.
^^^
### Slots
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``label`` | [^slot-label] |
2020-08-13 11:47:56 +08:00
2020-12-22 16:33:30 +08:00
^^^slot-label
2020-08-13 11:47:56 +08:00
The label content of each node. Displays the `label` property of each item by default.
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The descriptive label of the node. |
| `value` | `string` | The value of the node. |
| `disabled` | `boolean=` | Whether the node is disabled. |
| `children` | `Array<Object>=` | The child nodes of the node. The node type is the same as `datasource` items. |
| `level` | `number` | The depth of the node within the tree structure. `0` stands for the top level. |
| `overlay` | `boolean=` | Whether the node is displayed inside the overlay. |
+++
2022-01-24 18:53:52 +08:00
Additionally, custom properties apart from the listed ones will also be passes into the slot props object via `v-bind` .
2020-08-13 11:47:56 +08:00
:::tip
When `level` is `2` and `overlay` is `true` , the information of selected node count vs total node count will be displayed after the node label.
:::
^^^
### Events
| Name | Description |
| -- | -- |
2021-10-20 01:11:27 +08:00
| ``select`` | [^event-select] |
2020-08-13 11:47:56 +08:00
^^^event-select
:::badges
`v-model`
:::
2021-10-20 01:11:27 +08:00
Triggered when the selection changed. The callback parameter list is `(value: Array)` . The type of `value` is the same as the [`selected` ](#props-selected ) prop.
2020-08-13 11:47:56 +08:00
^^^