nf-popup-lazy-select
Popover-hosted asynchronous select with a custom trigger, optional assignment, close-on-select, selected object callbacks and manual visibility control.
Examples
Multiple / single / close / assign
Echo
Props
Descriptions preserve common-ui semantics; defaults and signatures follow the current Vue 3 implementation. Compatibility props do not enable unsupported legacy rendering.
| Attribute | Description | Type | Values | Default |
|---|---|---|---|---|
modelValue / v-model (value) | Bound value; value remains compatible; prefer v-model in Vue 3 | SelectModelValue | — | undefined |
tag | Custom rendering tag; div or custom-select-dropdown displays an inline list | string | Component | — | 'custom-select-dropdown' |
popdownOnSelect | Close popup on selection in single mode | boolean | — | false |
assignmentOnSelect | Update bound value on selection; false still reports clicked item | boolean | — | true |
emitSelectedItemOnClick | get-selected-data returns values by default; true returns full records | boolean | — | false |
visibleChangeKeywordCached | Preserve keyword across closing and reopening | boolean | — | true |
visibleChangeSelectListCached | Preserve searched list across closing and reopening | boolean | — | true |
keyValue | Fields used for option label and value | [string, string] | — | ['label', 'value'] |
virtualList | Enable virtual scrolling | boolean | — | false |
dataKey | Unique virtual row key: field name or function | string | ((row: SelectOption) => string | number) | — | 'templateId' |
itemOptions | Configure list properties and events together; event names accept kebab-case or camelCase | Record<string, unknown> | — | {} |
dataComponent | Custom option component receiving source, index and extraProps | Component | — | undefined |
estimateSize | Estimated row height in px | number | — | 34 |
keeps | Minimum inline virtual window; dropdown virtualization is managed by SelectV2 | number | — | 30 |
request | Paginated request returning records and total record count; parameters and context below | LazySelectRequest | — | undefined |
initList | Load initially; false defers loading until focus | boolean | — | true |
pageSize | Number of records per request | number | — | 10 |
keywordAlias | Request field for search keyword | string | — | 'keyword' |
pageNoAlias | Request field for page number | string | — | 'pageNo' |
pageSizeAlias | Request field for page size | string | — | 'pageSize' |
valueAlias | Initial request field for selected values | string | — | 'value' |
loadingDesc | Loading message | string | — | Locale configuration |
height | Scrollable list height | string | — | '245px' |
width | Selector width | string | — | '100%' |
maxWidth | Maximum selector width | string | — | undefined |
showTip | Show option tooltip | boolean | — | true |
multiple | Enable multiple selection | boolean | — | false |
disabled | Disable interaction | boolean | — | Inherited configuration |
size | Input size; mini / medium map to small / default | SelectSize | small / default / large / mini / medium | 'mini' |
collapseTags | Collapse selected tags in multiple mode | boolean | — | multiple |
multipleLimit | Maximum selected items; 0 means unlimited | number | — | 0 |
placeholder | Input placeholder | string | — | Locale configuration |
noDataText | Empty list text; can use the empty slot | string | — | Locale configuration |
popperClass | Dropdown CSS class | string | — | undefined |
start | Initial inline scroll index | number | — | 0 |
offset | Initial inline scroll offset in px | number | — | 0 |
direction | Compatibility field; currently has no effect | String | vertical | undefined |
pageMode | Compatibility field; currently has no effect | boolean | — | undefined |
topThreshold | Top threshold for totop; may fire repeatedly | number | — | 0 |
bottomThreshold | Bottom threshold for tobottom; may fire repeatedly | number | — | 0 |
rootTag | Inline list root tag | String | — | 'div' |
wrapTag | Inline list wrapper tag | String | — | 'div' |
wrapClass | Compatibility field; currently has no effect | String | — | undefined |
wrapStyle | Inline list wrapper style | CSSProperties | — | undefined |
itemTag | Inline row wrapper tag | String | — | 'div' |
itemClass | Inline row CSS class | String | — | undefined |
itemClassAdd | Extra row class function (index, row) | (index: number, row: SelectOption) => string | — | undefined |
itemStyle | Inline row style | CSSProperties | — | undefined |
itemScopedSlots | Compatibility field; currently has no effect | Object | — | undefined |
headerTag | Compatibility field; currently has no effect | String | — | undefined |
headerClass | Compatibility field; currently has no effect | String | — | undefined |
headerStyle | Compatibility field; currently has no effect | CSSProperties | — | undefined |
footerTag | Compatibility field; currently has no effect | String | — | undefined |
footerClass | Compatibility field; currently has no effect | String | — | undefined |
footerStyle | Compatibility field; currently has no effect | CSSProperties | — | undefined |
options | List of selectable options | SelectOption[] | — | [] |
selectAll | Show select-all control | boolean | — | false |
selectAllText | Select-all label | string | — | Locale configuration |
clearable | Show the clear selection control | boolean | — | true |
reserveKeyword | Keep the search keyword after selection | boolean | — | true |
filterable | Enable searching | boolean | — | true |
filterMethod | Custom filtering function | (query: string) => void | Promise<void> | — | undefined |
remote | Use remote filtering | boolean | — | false |
loading | Loading state | boolean | — | false |
popperAppendToBody | Teleport dropdown to body; maps to Element Plus teleported | boolean | — | true |
defaultFirstOption | Select the first match on Enter | boolean | — | false |
allowCreate | Allow new options; requires filterable | boolean | — | false |
automaticDropdown | Open non-filterable select on focus | boolean | — | false |
name | Native input name | string | — | undefined |
keywordHighlight | Highlight search keyword | boolean | — | true |
keywordLabelAlias | Compatibility field; highlighting uses text nodes, without HTML injection | string | — | 'keywordHighlightLabel' |
echoValueTop | Move selected rows to top in virtual list | boolean | — | true |
extraProps | Extra props passed to custom option component | Record<string, unknown> | — | undefined |
headeClass | Compatibility field; currently has no effect | string | — | undefined |
beforeVisibleChange | Post-visibility hook; return break to skip subsequent internal handling | (visible: boolean) => void | "break" | "discard-cache" | Promise<void | "break" | "discard-cache"> | — | undefined |
placement | Dropdown placement | SelectProps["placement"] | — | undefined |
initListAssigmentValue | Compatibility prop; initial data does not overwrite the bound value | boolean | — | false |
noDataImg | Show NfEmpty when no data | boolean | — | false |
allowEmptySearch | Allow requests with an empty keyword | boolean | — | true |
popupWidth | Popup width | number | string | — | 200 |
popupClass | Popup CSS class | string | — | undefined |
popupTitle | Popup title | string | — | undefined |
popupDisabled | Disable popup | boolean | — | false |
popupOffset | Popup offset | number | — | 0 |
popupPlacement | Popup placement | PopoverProps["placement"] | — | 'bottom' |
popupTrigger | Popup trigger | string | click / hover / focus / manual | 'click' |
popupTransition | Popup transition name | string | — | undefined |
popupVisibleArrow | Show popup arrow | boolean | — | true |
popupOptions | Options passed to Popper | object | — | undefined |
popupOpenDelay | Popup open delay in ms | number | — | undefined |
popupCloseDelay | Popup close delay in ms | number | — | 200 |
popupTabindex | Popup trigger tabindex | number | — | 0 |
request(params, context) accepts a synchronous result or Promise. params uses the aliases above for page, page size and keyword; initial echo also includes selected values (including 0 / false). context.data is the normalized list, originData the raw records and allCachedDataList the instance cache. Return total as record count, not page count. In fetch-data, current is the current page; records is the raw response, data the accumulated normalized list and originData the accumulated raw list.
type RequestParams = Record<string, string | number | boolean | (string | number | boolean)[] | undefined>
interface RequestContext {
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}
type RequestResult = { records: SelectOption[]; total: number }
type LazySelectRequest = (params: RequestParams, context: RequestContext) => RequestResult | Promise<RequestResult>
interface FetchCallBackData {
total: number
current: number
hasMore: boolean
keyword: string
records: SelectOption[]
data: SelectOption[]
originData: SelectOption[]
allCachedDataList: SelectOption[]
}Events
| Event | Description | Arguments |
|---|---|---|
update:modelValue | Selection changed; update v-model | (value: SelectModelValue) |
update:value | Selection changed; compatibility event | (value: SelectModelValue) |
input | Selection changed; compatibility event | (value: SelectModelValue) |
change | Fires when selection changes | (value: SelectModelValue) |
focus | Input gains focus | (event: FocusEvent) |
blur | Input loses focus | (event: FocusEvent) |
clear | Clear control activated | () |
remove-tag | Tag removed in multiple mode | (value: SelectValue) |
visible-change | Dropdown shown: true; hidden: false | (visible: boolean) |
select-item | Option clicked; returns its value | (value: SelectValue) |
scroll | List scroll; Event only, without the old range argument | (event: Event) |
totop | List reaches top threshold | (event?: Event) |
tobottom | List reaches bottom threshold | (event?: Event) |
resized | List viewport measurement | (id: string | number, size: number) |
fetch-data | After each successful request | (data: FetchCallBackData) |
fetch-error | Request failed | (error: unknown) |
get-selected-data | Selection data; emitSelectedItemOnClick chooses values or full records | (valueOrRows: SelectModelValue | SelectOption | (SelectOption | undefined)[]) |
popup-show | Popup starts showing; true | (visible: true) |
popup-hide | Popup starts hiding; false | (visible: false) |
popup-after-enter | Show transition finished; no arguments | () |
popup-after-leave | Hide transition finished; no arguments | () |
Slots
| Slot | Description | Scope |
|---|---|---|
default | Popup trigger/reference element | — |
option | Custom option content | { row: SelectOption, item: SelectOption, index: number } |
header | List header | — |
footer | List footer | — |
prefix | Input prefix | — |
empty | Empty option list content | — |
loading | Custom loading state | — |
tag | Custom selected tags | Element Plus tag slot props |
Exposed methods and state
currentValpopuppopLazySelectRefdataListdataMapallCachedDataList
Migration notes
Vue 3 uses modelValue / update:modelValue; legacy value, update:value and input remain available on selection components. The implementation uses public Element Plus APIs, not Element UI internals. mini maps to small; medium maps to default.
request(params, context) returns { records, total }. Stale requests cannot overwrite the current search. fetch-error reports failures; retry the same page. allCachedDataMap / dataMap are typed Maps.
