Skip to content

TreeSelect

The tree selector of the dropdown menu.

Basic usage

Basic usage example.

V-model

The selected value supports v-model.

Selected key:

Value format

When labelInValue is true, the format of value is: `{ label: string, value: string }`.

Selected value:

Dynamic loading

Load nodes dynamically via loadMore. At this time, isLeaf can be set to indicate leaf nodes.

Setting allow-search is true to enable the search function. You can only search in the loaded data during dynamic loading. The default keyword search is to match from the value field. You can also pass in filterTreeNode to customize the filtering method.

Basic search

Custom search

Listen to the search event, get the data in the event processing function and update the treeData. When customizing the search logic, it is recommended to turn off the internal filtering logic disable-filter is true to prevent the customized results be affected.

Multiple

Multiple Selection.

Basic

Please select

Max tag count is 2

Please select

Checkable

The tree checkable property can display checkbox.

Tree checkable

Please select

Tree check strictly

Please select

Checked strategy

Customize the return value through the treeCheckStrategy property.

Please select

Custom Tree Select the header and footer of the drop-down box.

Please select

Customize trigger element

Customize trigger element.

Control collapse

The dropdown expanded by default. Use popupVisible and onVisibleChange to control the expansion and collapse of the dropdown.For example, in this demo, onVisibleChange is triggered when the mouse moves out of the dropdown and the popup, the parameter is false, and the dropdown box is collapsed.

Customize treeData

You can customize treeData by fieldNames.

Virtual list

How to use the virtual list.

Fallback option

Using fallback-option to customize the display effect of the value of the option that is not found. By default, the value itself is displayed when the option is not found. Users can set this to false to hide values that do not match node data.

fallback

Size

Four sizes (small, default, large, huge) can be selected through size.

Please select

TreeSelect API

TreeSelect Attributes

NameDescriptionTypeDefault
disabledWhether to disableBooleanfalse
loadingWhether it is loading stateBooleanfalse
sizeThe size of the selection box.Stringmedium
borderWhether to show the borderBooleantrue
allow-searchWhether to allow searchingBooleanObjectfalse
allow-clearWhether to allow clearBooleanfalse
placeholderPrompt copyString-
max-tag-countThe maximum number of labels displayed, only valid in multi-select modeNumber-
multipleWhether to support multiple selectionBooleanfalse
default-valueDefault valueStringNumberArray-
model-value / v-modelBind valueStringNumberArray-
field-namesSpecify the field name in the node dataObject-
datadataArray[]
label-in-valueSetting the value format. The default is string, when set to true, the value format is: '{label: string, value: string}'Booleanfalse
tree-checkableWhether to show checkboxBooleanfalse
tree-check-strictlyWhether the parent and child nodes are relatedBooleanfalse
tree-checked-strategyCustomized echo methodStringall
tree-propsCan accept Props of all Tree componentsObject-
trigger-propsCan accept Props of all Trigger componentsObject-
popup-visible / v-modelWhether the pop-up box is visibleBoolean-
default-popup-visibleWhether the default pop-up box is visibleBooleanfalse
dropdown-styleDropdown box styleObject-
dropdown-class-nameDropdown box style classStringArray-
filter-tree-nodeCustom node filter functionFunction-
load-moreLoad data dynamicallyFunction-
disable-filterDisable internal filtering logicBooleanfalse
popup-containerMount container for pop-up boxStringHTMLElement-
fallback-optionCustomize node data for keys that do not match optionsBooleanFunctiontrue
selectableSetting the nodes that can be selected, all can be selected by defaultBooleantrue
scrollbarWhether to enable virtual scroll barBooleanObjecttrue
show-header-on-emptyWhether to display the header in the empty stateBooleanfalse
show-footer-on-emptyWhether to display the footer in the empty stateBooleanfalse

TreeSelect Events

NameDescriptionType
changeTrigger when the value changesFunction
popup-visible-changeTriggered when the status of the drop-down box changesFunction
searchTriggered when the search value changesFunction
clearTriggered when clear is clicked-

TreeSelect Slots

NameDescriptionParams
triggerCustom trigger element-
prefixPrefix-
labelCustom Labeldata: mixed
headerThe header of the drop-down box-
loaderCustomizing the content displayed during loading-
emptyCustom empty data display-
footerThe footer of the drop-down box-
tree-slot-extraRender additional node content of the tree component-
tree-slot-titleCustom the node title of the tree component-
tree-slot-iconCustom node icon for the tree componentnode: TreeNodeData
tree-slot-switcher-iconCustom switcher icon for the tree component-