Skip to content

FaTreeSelect ​

Combines ElSelect and ElTree props, events and exposed methods with Fast data loading, label synchronization and default field mapping.

Since 2.0.28, cache-data accepts objects with the same fields as the tree data and lets the native tree selector restore labels. Provide native load to load individual nodes when requestApi is absent. The default slot also receives store; selected-tag slots use the same scopes as FaSelect.

Tree Select

Interactive example
View code
Vue
<template>
	<div style="display: grid; max-width: 480px; gap: 12px">
		<FaTreeSelect
			:request-api="requestApi"
			v-model="singleValue"
			v-model:label="singleLabel"
			check-strictly
			filterable
			clearable
			placeholder="选择单个节点"
			@change="singleChangedData = $event"
		/>
		<span class="demo-value">
			单选值:{{ JSON.stringify(singleValue) }};标签:{{ JSON.stringify(singleLabel) }};change 数据:{{ JSON.stringify(singleChangedData) }}
		</span>
		<FaTreeSelect
			v-model="multipleValue"
			v-model:label="multipleLabel"
			:data="data"
			multiple
			show-checkbox
			check-strictly
			filterable
			clearable
			placeholder="选择多个节点"
			@change="multipleChangedData = $event"
		/>
		<span class="demo-value">
			多选值:{{ JSON.stringify(multipleValue) }};标签:{{ JSON.stringify(multipleLabel) }};change 数据:{{
				JSON.stringify(multipleChangedData)
			}}
		</span>
	</div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const singleValue = ref<string>();
const singleLabel = ref<string | null>(null);
const multipleValue = ref<string[]>([]);
const multipleLabel = ref<string[] | null>([]);
const singleChangedData = ref<unknown>();
const multipleChangedData = ref<unknown>();
const data = [
	{
		value: "frontend",
		label: "前端组件",
		children: [
			{ value: "form", label: "表单" },
			{ value: "table", label: "表格" },
			{ value: "upload", label: "上传", disabled: true },
		],
	},
	{
		value: "backend",
		label: "后端 SDK",
		children: [
			{ value: "fast-net", label: "Fast.NET" },
			{ value: "fast-admin", label: "Fast.Admin" },
		],
	},
];
const requestApi = (): Promise<typeof data> => Promise.resolve(data);
</script>

FaTreeSelect Complete API

Props

EL defaults refer to Element Plus before Fast is imported. 2.14.7

PropertySourceDescriptionTypeDefault
modelValueFast overridev-model value.String / Number / Boolean / Object / ArrayFastfalseELfalse
loadingFast overrideLoading state.BooleanFastfalseELfalse
loadingTextFast global enhancementText shown while remote data loads.StringFast加载中...EL—
noMatchTextFast global enhancementText when filtering finds no matches.StringFast暂无匹配的数据EL—
noDataTextFast global enhancementText when no options/nodes exist.StringFast暂无数据EL—
collapseTagsFast global enhancementCollapse tags in multiple selection.BooleanFasttrueELfalse
collapseTagsTooltipFast global enhancementShow collapsed tags in a tooltip.BooleanFasttrueELfalse
propsFast overrideField mappings.ObjectFast{"label":"label","hide":"hide","disabled":"disabled","children":"children"}EL{"children":"children","label":"label","disabled":"disabled"}
dataFast overrideComponent data.ArrayFast[]EL[]
nodeKeyFast overrideUnique tree-node key.StringFastvalueEL—
defaultExpandAllFast global enhancementExpand all nodes by default.BooleanFasttrueELfalse
expandOnClickNodeFast global enhancementExpand/collapse when node content is clicked.BooleanFastfalseELtrue
checkOnClickNodeFast global enhancementToggle checking when a tree node is clicked.BooleanFasttrueELfalse
lazyFast overrideEnable lazy loading.BooleanFasttrueELfalse
highlightCurrentFast global enhancementHighlight the current tree node.BooleanFasttrueELfalse
filterNodeMethodFast overrideTree filter; false hides the node.FunctionFast—EL—
collapseOnClickNodeFast additionCollapse expanded siblings when a tree node is clicked.Booleanfalse
labelFast additionDisplay text or synchronized label.String / Array—
widthFast additionComponent width.String / Number100%
moreDetailFast additionEnable wider option-detail layout.Booleanfalse
defaultSelectedFast additionInitialize selection from the current value.Booleanfalse
requestApiFast additionAsynchronous data-request function.Function—
initParamFast additionInitial request parameters.String / Number / Object—
nameEL nativeIcon name, CSS class, or external SVG URL.String—
idEL nativeNative ID of the root input.String—
autocompleteEL nativeNative input autocomplete attribute.Stringoff
automaticDropdownEL nativeOpen dropdown automatically on focus.Booleanfalse
sizeEL nativeComponent size.String—
effectEL nativeTooltip theme for the dropdown.Stringlight
disabledEL nativeDisable the component or current option.Booleanfalse
clearableEL nativeAllow clearing.Booleanfalse
filterableEL nativeAllow filtering.Booleanfalse
allowCreateEL nativeAllow creating new options.Booleanfalse
popperClassEL nativeCustom dropdown-overlay class.String / Array / Object / Boolean""
popperStyleEL nativeCustom dropdown-root styles.String / Array / Object / Booleanfalse
popperOptionsEL nativePopper positioning options.Object{}
remoteEL nativeEnable remote search.Booleanfalse
debounceEL nativeRemote-search debounce in milliseconds.Number300
remoteMethodEL nativeLoader called when remote-search keywords change.Function—
filterMethodEL nativeLocal option-filtering function.Function—
multipleEL nativeAllow multiple selection.Booleanfalse
multipleLimitEL nativeMaximum selections; 0 means unlimited.Number0
placeholderEL nativePlaceholder.String—
defaultFirstOptionEL nativeSelect the first matching option on Enter.Booleanfalse
reserveKeywordEL nativeKeep the keyword after remote multiple selection.Booleantrue
valueKeyEL nativeUnique key field for object-valued options.Stringvalue
tagTooltipEL nativeCollapsed-tag tooltip options.Object{}
maxCollapseTagsEL nativeMaximum visible tags before collapsing.Number1
teleportedEL nativeTeleport the dropdown to appendTo.Booleantrue
persistentEL nativeKeep the hidden dropdown in the DOM.Booleantrue
clearIconEL nativeClear-button icon.String / Object / Function{"name":"CircleClose","__name":"circle-close"}
fitInputWidthEL nativeEnsure dropdown width is at least the input width.Booleanfalse
suffixIconEL nativeSelector suffix icon.String / Object / Function{"name":"ArrowDown","__name":"arrow-down"}
tagTypeEL nativeElement Plus type for selection tags.Stringinfo
tagEffectEL nativeElement Plus effect for selection tags.Stringlight
validateEventEL nativeTrigger form validation on model changes.Booleantrue
remoteShowSuffixEL nativeShow the selector suffix icon in remote mode.Booleanfalse
showArrowEL nativeShow the dropdown arrow pointing to its trigger.Booleantrue
offsetEL nativeOffset or overlay offset.Number12
placementEL nativePreferred dropdown placement relative to its trigger.Stringbottom-start
fallbackPlacementsEL nativeFallback overlay placements tried in order.Array["bottom-start","top-start","right","left"]
tabindexEL nativeNative input tabindex.String / Number0
appendToEL nativeOverlay mount target.String / Object—
optionsEL nativeVirtual-selector options.Array—
emptyValuesEL nativeModel values considered empty.Array—
valueOnClearEL nativeValue or factory used when clearing the model.String / Number / Boolean / Functionfalse
ariaLabelEL nativeAccessible component name.String—
emptyTextEL nativeEmpty-state text.String—
renderAfterExpandEL nativeRender children only after first expansion.Booleantrue
checkStrictlyEL nativeCheck parent and child nodes independently.Booleanfalse
checkOnClickLeafEL nativeToggle checking when a leaf is clicked.Booleantrue
checkDescendantsEL nativeCheck loaded descendants of a checked parent.Booleanfalse
autoExpandParentEL nativeAutomatically expand parents when expanding a node.Booleantrue
defaultCheckedKeysEL nativeInitially checked node keys.Array—
defaultExpandedKeysEL nativeInitially expanded node keys.Array—
currentNodeKeyEL nativeInitially current node key.String / Number—
renderContentEL nativeCustom tree-node renderer.Function—
showCheckboxEL nativeShow tree-node checkboxes.Booleanfalse
draggableEL nativeAllow dragging.Booleanfalse
allowDragEL nativePredicate allowing a tree node to be dragged.Function—
allowDropEL nativePredicate allowing a dragged node to be dropped at a target.Function—
loadEL nativeLazy tree-node loader.Function—
accordionEL nativeExpand only one sibling tree node at a time.Booleanfalse
indentEL nativeHorizontal tree-level indentation in pixels.Number18
iconEL nativeIcon component or name.String / Object / Function—
cacheDataEL nativeCached lazy-tree nodes used to resolve selected labels.Array[]

Events

NameSourceDescriptionParameters / type
update:modelValueFast additionUpdates v-model.—
changeFast additionValue or selection changes.—
popup-scrollFast additionSelector dropdown scrolls.—
end-reachedFast additionSelector reaches a dropdown scroll boundary.—
remove-tagFast additionA multiple-selection tag is removed; receives the removed value.—
visible-changeFast additionSelector dropdown visibility changes.—
focusFast additionComponent gains focus.—
blurFast additionComponent loses focus.—
clearFast additionClear-button click after clearing completes.—
check-changeFast additionTree-node selection changes.—
current-changeFast additionCurrent table row, tree node, or selected value changes.—
node-clickFast additionTree-node click.—
node-contextmenuFast additionTree-node context menu.—
node-collapseFast additionTree node collapses.—
node-expandFast additionTree node expands.—
checkFast additionTree checkbox click with node data and checked collections.—
node-drag-startFast additionTree-node dragging starts.—
node-drag-endFast additionTree-node dragging ends.—
node-dropFast additionTree-node drop completes.—
node-drag-leaveFast additionDragged node leaves a target.—
node-drag-enterFast additionDragged node enters a target.—
node-drag-overFast additionDragged node moves over a target.—
update:labelFast additionUpdates the label model.—
dataChangeFast additionAsynchronous data loading completes.—

Slots

NameSourceDescriptionParameters / type
defaultEL nativeDefault component content.—
headerEL nativeCustom header or table-header business content.—
footerEL nativeCustom footer actions; overlays provide loading and close.—
prefixEL nativeCustom selector input prefix.—
emptyEL nativeCustom empty-state content.—
tagEL nativeCustom multiple-selection tags.—
loadingEL nativeCustom loading content.—
labelEL nativeCustom form, tree-node, or option label.—

Exposes

NameSourceDescriptionParameters / type
focusEL nativeFocuses the input/selector.—
blurEL nativeBlurs the input/selector.—
selectedLabelFast additionCurrent selector display label.—
filterEL nativeFilters tree nodes by keyword.—
updateKeyChildrenFast additionUpdates tree/tree-table children by node key.—
getCheckedNodesFast additionGets checked tree-node data.—
setCheckedNodesFast additionSets checked nodes by data.—
getCheckedKeysFast additionGets checked tree-node keys.—
setCheckedKeysFast additionSets checked nodes by keys.—
setCheckedFast additionSets a tree node's checked state.—
getHalfCheckedNodesFast additionGets partially checked tree-node data.—
getHalfCheckedKeysFast additionGets partially checked tree-node keys.—
getCurrentKeyFast additionGets the current tree-node key.—
getCurrentNodeFast additionGets current tree-node data.—
setCurrentKeyFast additionSets the current tree node by key.—
setCurrentNodeFast additionSets the current tree node by data.—
getNodeFast additionGets a tree-node instance by data or key.—
removeFast additionRemoves a tree node.—
appendFast additionAppends a tree child.—
insertBeforeFast additionInserts before a tree node.—
insertAfterFast additionInserts after a tree node.—
treeRefEL nativeFaTreeSelect internal ElTree ref.—
selectRefEL nativeFaTreeSelect internal ElSelect ref.—
loadingFast additionFast business loading state.—
refreshFast additionRepeats the data request or refreshes business content.—
setSelectionFast additionSets the selector value and label.—
clearSelectionFast additionClears the current selection.—

FaTreeSelect instance methods ​

These are call snippets. Use rows, options and fields from your actual data.

focus Focus ​

Focuses the selector input.

Signature ​

ts
focus(): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.focus();
}
</script>

Input: No parameters.

Returns: void.

blur Blur ​

Blurs the selector input and hides the dropdown.

Signature ​

ts
blur(): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.blur();
}
</script>

Input: No parameters.

Returns: void.

filter Filter ​

Filters tree nodes, hiding excluded nodes.

Signature ​

ts
filter(value: FilterValue): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.filter(1);
}
</script>

Input ​

InputTypeRequired / defaultDescription
valueanyRequiredForm value, selected value, or filter keyword to set.

Returns ​

ValueTypeDescription
resultvoidNo return value.

updateKeyChildren Node ​

Sets node data; requires node-key.

Signature ​

ts
updateKeyChildren(key: import("element-plus").TreeKey, data: import("element-plus").TreeData): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.updateKeyChildren(1, [{ id: 11, label: "Fast" }]);
}
</script>

Input ​

InputTypeRequired / defaultDescription
keyTreeKeyRequiredUnique node, row, or column identifier.
dataTreeDataRequiredBusiness data to query, insert, remove, or replace.

Returns ​

ValueTypeDescription
resultvoidNo return value.

getCheckedNodes Selection ​

Gets checked nodes.

Signature ​

ts
getCheckedNodes(leafOnly?: boolean, includeHalfChecked?: boolean): TreeNodeData[];

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getCheckedNodes(true, true);
	console.log(result);
}
</script>

Input ​

InputTypeRequired / defaultDescription
leafOnlyboolean | undefinedOptionalWhether to return only leaf nodes.
includeHalfCheckedboolean | undefinedOptionalWhether to include partially checked nodes.

Returns ​

ValueTypeDescription
resultTreeNodeData[]Method result consistent with the current component state.

setCheckedNodes Selection ​

Sets checked nodes.

Signature ​

ts
setCheckedNodes(nodes: import("element-plus/es/components/tree/src/model/node.mjs").default[], leafOnly?: boolean): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.setCheckedNodes([row], true);
}
</script>

Input ​

InputTypeRequired / defaultDescription
nodesNode[]RequiredNodes to check.
leafOnlyboolean | undefinedOptionalWhether to return only leaf nodes.

Returns ​

ValueTypeDescription
resultvoidNo return value.

getCheckedKeys Selection ​

Gets checked node keys.

Signature ​

ts
getCheckedKeys(leafOnly?: boolean): import("element-plus").TreeKey[];

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getCheckedKeys(true);
	console.log(result);
}
</script>

Input ​

InputTypeRequired / defaultDescription
leafOnlyboolean | undefinedOptionalWhether to return only leaf nodes.

Returns ​

ValueTypeDescription
resultTreeKey[]Method result consistent with the current component state.

setCheckedKeys Selection ​

Sets checked node keys.

Signature ​

ts
setCheckedKeys(keys: import("element-plus").TreeKey[], leafOnly?: boolean): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.setCheckedKeys(["name"], true);
}
</script>

Input ​

InputTypeRequired / defaultDescription
keysTreeKey[]RequiredNode keys to check.
leafOnlyboolean | undefinedOptionalWhether to return only leaf nodes.

Returns ​

ValueTypeDescription
resultvoidNo return value.

setChecked Selection ​

Sets node checked state.

Signature ​

ts
setChecked(data: import("element-plus").TreeKey | TreeNodeData, checked: boolean, deep?: boolean): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.setChecked(row, true, true);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeData | TreeKeyRequiredBusiness data to query, insert, remove, or replace.
checkedbooleanRequiredWhether the target node is checked.
deepboolean | undefinedOptionalWhether descendants are included.

Returns ​

ValueTypeDescription
resultvoidNo return value.

getHalfCheckedNodes Selection ​

Gets partially checked nodes.

Signature ​

ts
getHalfCheckedNodes(): TreeNodeData[];

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getHalfCheckedNodes();
	console.log(result);
}
</script>

Input ​

This method has no input parameters.

Returns ​

ValueTypeDescription
resultTreeNodeData[]Method result consistent with the current component state.

getHalfCheckedKeys Selection ​

Gets partially checked node keys.

Signature ​

ts
getHalfCheckedKeys(): import("element-plus").TreeKey[];

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getHalfCheckedKeys();
	console.log(result);
}
</script>

Input ​

This method has no input parameters.

Returns ​

ValueTypeDescription
resultTreeKey[]Method result consistent with the current component state.

getCurrentKey Current ​

Gets the current node key.

Signature ​

ts
getCurrentKey(): import("element-plus").TreeKey | null;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getCurrentKey();
	console.log(result);
}
</script>

Input ​

This method has no input parameters.

Returns ​

ValueTypeDescription
resultTreeKey | nullMethod result consistent with the current component state.

getCurrentNode Current ​

Gets the current node.

Signature ​

ts
getCurrentNode(): TreeNodeData | null;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	const result = componentRef.value?.getCurrentNode();
	console.log(result);
}
</script>

Input ​

This method has no input parameters.

Returns ​

ValueTypeDescription
resultTreeNodeData | nullMethod result consistent with the current component state.

setCurrentKey Current ​

Sets the current node key.

Signature ​

ts
setCurrentKey(key?: import("element-plus").TreeKey | null, shouldAutoExpandParent?: boolean): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.setCurrentKey(1, true);
}
</script>

Input ​

InputTypeRequired / defaultDescription
keyTreeKey | null | undefinedOptionalUnique node, row, or column identifier.
shouldAutoExpandParentboolean | undefinedOptionalWhether to automatically expand the target's parents.

Returns ​

ValueTypeDescription
resultvoidNo return value.

setCurrentNode Current ​

Sets the current node.

Signature ​

ts
setCurrentNode(node: import("element-plus/es/components/tree/src/model/node.mjs").default, shouldAutoExpandParent?: boolean): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.setCurrentNode(row, true);
}
</script>

Input ​

InputTypeRequired / defaultDescription
nodeNodeRequiredElement Plus Tree node instance.
shouldAutoExpandParentboolean | undefinedOptionalWhether to automatically expand the target's parents.

Returns ​

ValueTypeDescription
resultvoidNo return value.

getNode Node ​

Gets a node by data or key.

Signature ​

ts
getNode(data: import("element-plus").TreeKey | TreeNodeData): import("element-plus/es/components/tree/src/model/node.mjs").default;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	const result = componentRef.value?.getNode(row);
	console.log(result);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeData | TreeKeyRequiredBusiness data to query, insert, remove, or replace.

Returns ​

ValueTypeDescription
resultNodeMethod result consistent with the current component state.

remove Remove ​

Removes a node.

Signature ​

ts
remove(data: TreeNodeData | import("element-plus/es/components/tree/src/model/node.mjs").default): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.remove(row);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeData | NodeRequiredBusiness data to query, insert, remove, or replace.

Returns ​

ValueTypeDescription
resultvoidNo return value.

append Append ​

Appends a child node.

Signature ​

ts
append(data: TreeNodeData, parentNode: TreeNodeData | import("element-plus").TreeKey | import("element-plus/es/components/tree/src/model/node.mjs").default): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.append(row, row);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeDataRequiredBusiness data to query, insert, remove, or replace.
parentNodeTreeNodeData | TreeKey | NodeRequiredParent data, key, or node instance for insertion.

Returns ​

ValueTypeDescription
resultvoidNo return value.

insertBefore Insert ​

Inserts before a specified node.

Signature ​

ts
insertBefore(data: TreeNodeData, refNode: import("element-plus").TreeKey | TreeNodeData | import("element-plus/es/components/tree/src/model/node.mjs").default): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.insertBefore(row, row);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeDataRequiredBusiness data to query, insert, remove, or replace.
refNodeTreeNodeData | TreeKey | NodeRequiredReference node data, key, or instance for insertion.

Returns ​

ValueTypeDescription
resultvoidNo return value.

insertAfter Insert ​

Inserts after a specified node.

Signature ​

ts
insertAfter(data: TreeNodeData, refNode: import("element-plus").TreeKey | TreeNodeData | import("element-plus/es/components/tree/src/model/node.mjs").default): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
const row = { id: 1, name: "Fast" };
function handleExample() {
	componentRef.value?.insertAfter(row, row);
}
</script>

Input ​

InputTypeRequired / defaultDescription
dataTreeNodeDataRequiredBusiness data to query, insert, remove, or replace.
refNodeTreeNodeData | TreeKey | NodeRequiredReference node data, key, or instance for insertion.

Returns ​

ValueTypeDescription
resultvoidNo return value.

refresh Refresh ​

Refreshes.

Signature ​

ts
refresh(): Promise<void>;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
async function handleExample() {
	const result = await componentRef.value?.refresh();
	console.log(result);
}
</script>

Input ​

This method has no input parameters.

Returns ​

ValueTypeDescription
resultPromise<void>Asynchronous result; callers handle Promise rejection.

setSelection Selection ​

Sets the selection.

Signature ​

ts
setSelection(value: Exclude<ElSelectorModelValue, null | undefined>): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.setSelection(1);
}
</script>

Input ​

InputTypeRequired / defaultDescription
valueElSelectorValue | ElSelectorValue[]RequiredForm value, selected value, or filter keyword to set.

Returns ​

ValueTypeDescription
resultvoidNo return value.

clearSelection Selection ​

Clears the selection.

Signature ​

ts
clearSelection(): void;

Example ​

vue
<template>
	<FaTreeSelect ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { FaTreeSelect } from "fast-element-plus";

const componentRef = ref<InstanceType<typeof FaTreeSelect>>();
function handleExample() {
	componentRef.value?.clearSelection();
}
</script>

Input: No parameters.

Returns: void.