Skip to content

CommonSelect

Public selector supporting select, selectV2, and treeSelect.

Basic Usage

loading

Component Types

loading

Multiple Selection

loading

Multiple Selection with Delimiter

loading

Get Request Data

Below we simulate a request Internally, the default API wrapper is used. If you want to customize it, you can override it by wrapping with hooks asyncCache

loading

Request Result Field Mapping

If the request result is not in value-label format, use labelField and valueField to get

loading

Result Format Conversion

For example, if the interface gives string data but we store numbers in the business, they may not match. Use valueType

loading

If the request format is inconsistent or value/label needs to be concatenated

Use parseData. You can register this globally. If it doesn't meet requirements during development, override it in config

loading

Dictionary

First, you need to globally register the dictionary data acquisition method for this project in main.ts and inject the getDictOptions parameter. The function returns a Promise. Let's simulate it below

loading

Request Parameters/Filter Options

In the API case, parameters are added to the passed function, and changes in query return data will trigger a new request with new parameters

loading
loading
loading

Wait for All Query Parameters to Have Values Before Getting Data

loading

Auto Selection

Automatically select when there is only one data item. Only valid for API and dict

loading

Append Options

Append options. Internal deduplication will be performed

loading

Sorting

loading

CommonSelect Attributes (Props)

AttributeDescriptionTypeDefault
apiRequest API interface methodFunction-
dictDictionary name, used to get options from dictionarystring | string[]-
queryRequest parameter configuration methodFunction-
valueFieldValue field mapping field namestring-
labelFieldText field mapping field namestring-
parseDataMethod to transform request resultsFunction-
autoSelectFirstWhether to automatically select when there is only one data itembooleanfalse
multipleWhether it is multiple selectionbooleanfalse
needAllQueryParamsWhether to pass all query parametersbooleanfalse
appendOptionsAppended option list or methodRecord<any, any>[] | Function-
valueTypeValue type, supports 'string', 'String', 'int', 'Int''string' | 'String' | 'int' | 'Int'-
optionsBound option listRecord<any, any>[]-
ignoreByLabelIgnored label liststring[]-
componentTypeComponent type, supports 'ElSelectV2', 'ElSelect', 'ElTreeSelect''ElSelectV2' | 'ElSelect' | 'ElTreeSelect''ElSelect'
joinSplitConcatenation delimiter when merging results in multiple selectionstringNone
orderBySort field namestring-
orderTypeSort order, supports 'asc' or 'desc''asc' | 'desc'-
getDictOptionsMethod to get dictionary optionsFunction-