Skip to content

FaSelectPage ​

Combines keyword search, pagination and selected-label restoration inside the dropdown. requestApi follows the Fast PagedInput / PagedResult contract.

Since 2.0.28, #tag receives { data, deleteTag, selectDisabled } and #label includes the native index. requestApi still supplies paginated options.

Select Page

Interactive example
View code
Vue
<template>
	<div class="demo-stack">
		<FaSelectPage
			ref="selectRef"
			v-model="value"
			v-model:label="label"
			:request-api="requestApi"
			clearable
			:placeholder="english ? 'Search and paginate' : '搜索并翻页'"
			:loading-text="english ? 'Loading…' : '加载中...'"
			:no-match-text="english ? 'No matching users' : '暂无匹配的数据'"
			:no-data-text="english ? 'No users' : '暂无数据'"
			style="max-width: 420px"
			@change="changedData = $event"
		/>
		<div>
			<ElButton @click="selectRef?.focus?.()">{{ english ? "Focus" : "聚焦" }}</ElButton>
			<ElButton @click="selectRef?.blur?.()">{{ english ? "Blur" : "失焦" }}</ElButton>
			<ElButton @click="selectRef?.refresh(1)">{{ english ? "Refresh page 1" : "刷新到第一页" }}</ElButton>
		</div>
		<span class="demo-value" role="status">{{ english ? "Completed requests" : "已完成请求" }}: {{ completedRequests }}</span>
		<span class="demo-value">
			{{ english ? "Current user" : "当前用户" }}: {{ label ?? (english ? "None" : "未选择") }} ({{ value ?? "—" }}) ·
			{{ english ? "Change data" : "change 数据" }}: {{ JSON.stringify(changedData) }}
		</span>
	</div>
</template>

<script setup lang="ts">
import { computed, ref, useTemplateRef } from "vue";
import { ElButton } from "element-plus";
import { FaSelectPage } from "fast-element-plus";
import type { PagedInput, PagedResult } from "fast-element-plus";

const selectRef = useTemplateRef<InstanceType<typeof FaSelectPage>>("selectRef");
const props = defineProps<{ language?: "zh-CN" | "en-US" }>();
const english = computed(() => props.language === "en-US");
const completedRequests = ref(0);
const value = ref<number | null>(null);
const label = ref<string | null>(null);
const changedData = ref<unknown>();
const allRows = computed(() =>
	Array.from({ length: 36 }, (_, index) => ({
		value: index + 1,
		label: `${english.value ? "User" : "业务用户"} ${String(index + 1).padStart(2, "0")}`,
	}))
);

const requestApi = async (input?: PagedInput): Promise<PagedResult<Record<string, unknown>>> => {
	await new Promise<void>((resolve) => {
		window.setTimeout(resolve, 250);
	});
	const keyword = input?.searchValue?.toLowerCase() ?? "";
	const filtered = allRows.value.filter((item) => item.label.toLowerCase().includes(keyword));
	const pageIndex = input?.pageIndex ?? 1;
	const pageSize = input?.pageSize ?? 10;
	completedRequests.value++;
	return {
		pageIndex,
		pageSize,
		totalRows: filtered.length,
		rows: filtered.slice((pageIndex - 1) * pageSize, pageIndex * pageSize),
	};
};
</script>

Use the focus and refresh buttons in the example above. The input focus and completed-request count show when the calls take effect.

FaSelectPage 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
popperClassFast overrideCustom dropdown-overlay class.String / Array / Object / BooleanFast""EL""
remoteFast overrideEnable remote search.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{"label":"label","value":"value","disabled":"disabled","options":"options"}
labelFast additionDisplay text or synchronized label.String / Array—
widthFast additionComponent width.String / Number100%
moreDetailFast additionEnable wider option-detail layout.Booleanfalse
requestApiRequiredFast 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
popperStyleEL nativeCustom dropdown-root styles.String / Array / Object / Booleanfalse
popperOptionsEL nativePopper positioning options.Object{}
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—

Events

NameSourceDescriptionParameters / type
update:modelValueEL nativeUpdates v-model.—
changeEL nativeValue or selection changes.—
popup-scrollEL nativeSelector dropdown scrolls.—
end-reachedEL nativeSelector reaches a dropdown scroll boundary.—
remove-tagEL nativeA multiple-selection tag is removed; receives the removed value.—
visible-changeEL nativeSelector dropdown visibility changes.—
focusEL nativeComponent gains focus.—
blurEL nativeComponent loses focus.—
clearEL nativeClear-button click after clearing completes.—
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.—
selectedLabelEL nativeCurrent selector display label.—
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.—
selectedListFast additionComplete selected data objects.—
scrollToEL native · not forwardedScrolls the table/virtual list to a position.—
handleCloseEL native · not forwardedInvokes Element Plus internal closing behavior.—

FaSelectPage 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>
	<FaSelectPage ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

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

const componentRef = ref<InstanceType<typeof FaSelectPage>>();
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>
	<FaSelectPage ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

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

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

Input: No parameters.

Returns: void.

refresh Refresh ​

Refreshes.

Signature ​

ts
refresh(pageIndex?: number): Promise<void>;

Example ​

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

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

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

Input ​

InputTypeRequired / defaultDescription
pageIndexnumber | undefinedOptionalPage to switch to during refresh.

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>
	<FaSelectPage ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

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

const componentRef = ref<InstanceType<typeof FaSelectPage>>();
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>
	<FaSelectPage ref="componentRef" />
	<button type="button" @click="handleExample">Call method</button>
</template>

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

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

Input: No parameters.

Returns: void.

State and lifecycle ​

The latest valid response wins labels by value; old selected entries only retain off-page values. Clearing selection or replacing initParam removes stale display state. Disposed or superseded requests cannot update state.