Select

Cuando haya muchas opciones, utilice un menú desplegable para mostrar y seleccionar las que desee.

TIP

After version 2.5.0, the default width of el-select changed to 100%. When used in a inline form, the width will collapse. In order to display the width properly, you need to give el-select a specific width.

TIP

Este componente requiere el envoltorio <client-only></client-only> cuando se utiliza en SSR (por ejemplo: Nuxt) y SSG (por ejemplo: VitePress).

Uso básico

Opción deshabilitada

Deshabilitar el select

Desactivar todo el componente.

Selección individual limpiable

Puede limpiar el Select con un icono.

Selección múltiple básica

Selección múltiple utiliza etiquetas para mostrar las opciones seleccionadas.

Plantilla personalizada

Puede personalizar plantillas HTML para opciones.

Header of the dropdown 2.4.3

You can customize the header of the dropdown.

You can customize the footer of the dropdown.

Agrupando

Mostrar opciones en grupos.

Filtrado de opciones

Puede filtrar las opciones que desee.

Búsqueda remota

Introduzca palabras clave y busque los datos en el servidor.

Crear nuevos items

Crear y seleccionar nuevos elementos que no están incluidos en las opciones de selección

Usar el atributo value-key

Si el valor de vinculación de Select es un objeto, asegúrese de asignar value-key como su nombre único de clave de identidad.

Custom Tag 2.5.0

You can customize tags.

Custom Loading 2.5.2

Override loading content.

Empty Values 2.7.0

If you want to support empty string, please set empty-values to [null, undefined].

If you want to change the clear value to null, please set value-on-clear to null.

Select API

Select Attributes

NombreDescripciónTipoDefault
model-value / v-modelvalor vinculadostring / number / boolean / object / array
multiplesi multiple-select esta activobooleanfalse
disabledsi Select esta deshabilitadobooleanfalse
value-keysi se colapsan los tags a un texto cuando multiple es true.stringvalue
sizetamaño del inputenum
clearablesi el select puede ser limpiadobooleanfalse
collapse-tagssi contraer etiquetas a un texto con la selección múltiplebooleanfalse
collapse-tags-tooltip 2.3.0si se muestran todas las etiquetas seleccionadas al pasar el ratón sobre el texto de las etiquetas colapsadas. Para usar esto, collapse-tags debe ser truebooleanfalse
multiple-limitmáximo número de opciones que el usuario puede seleccionar cuando multiple es true. Sin límite cuando se fija a 0number0
nameel atributo name del input seleccionadostring
effecttooltip theme, built-in theme: dark / lightenum / stringlight
autocompleteel atributo autocomplete del input seleccionadostringoff
placeholderplaceholder, default is 'Select'string
filterablesi Select es filtrablebooleanfalse
allow-createsi está permitido crear nuevos ítems. Para usar esto, filterable debe ser true.booleanfalse
filter-methodmétodo de filtrado personalizadoFunction
remotesi las opciones se traerán desde el servidorbooleanfalse
remote-methodmétodo de búsqueda remota personalizadaFunction
remote-show-suffixen el método de búsqueda remota mostrar icono del sufijobooleanfalse
loadingsi Select está cargando datos del servidorbooleanfalse
loading-textdisplayed text while loading data from server, default is 'Loading'string
no-match-textdisplayed text when no data matches the filtering query, you can also use slot empty, default is 'No matching data'string
no-data-textdisplayed text when there is no options, you can also use slot empty, default is 'No data'string
popper-classnombre de clase personalizado para la lista desplegable de selecciónstring''
reserve-keywordwhen multiple and filterable is true, whether to reserve current keyword after selecting an optionbooleantrue
default-first-optionseleccione la primera opción de coincidencia al introducir la clave. Usar con filterable o remotebooleanfalse
teleportedwhether select dropdown is teleported to the bodybooleantrue
persistentwhen select dropdown is inactive and persistent is false, select dropdown will be destroyedbooleantrue
automatic-dropdownfor non-filterable Select, this prop decides if the option menu pops up when the input is focusedbooleanfalse
clear-iconcustom clear icon componentstring / objectCircleClose
fit-input-widthwhether the width of the dropdown is the same as the inputbooleanfalse
suffix-iconcustom suffix icon componentstring / objectArrowDown
suffix-transition deprecatedanimation when dropdown appears/disappears iconbooleantrue
tag-typetag typeenuminfo
validate-eventwhether to trigger form validationbooleantrue
placement 2.2.17position of dropdownenumbottom-start
fallback-placements 2.5.6list of possible positions for dropdown popper.jsarray['bottom-start', 'top-start', 'right', 'left']
max-collapse-tags 2.3.0the max tags number to be shown. To use this, collapse-tags must be truenumber1
popper-optionspopper.js parametersobjectrefer to popper.js doc{}
aria-label a11ysame as aria-label in native inputstring
empty-values 2.7.0empty values of component, see config-providerarray
value-on-clear 2.7.0clear return value, see config-providerstring / number / boolean / Function

WARNING

suffix-transition has been deprecated, and will be removed in 2.4.0, please use override style scheme.

Select Events

NombreDescripciónType
changese dispara cuando el valor del select cambiaFunction
visible-changese dispara cuando el menú desplegable aparece o desapareceFunction
remove-tagse dispara cuando un tag es removido en modo múltipleFunction
clearse dispara cuando el icono se clickea en un Select limpiableFunction
blurse dispara cuando el input pierde el focoFunction
focusse dispara cuando el input obtiene el focoFunction

Select Slots

Nombre del slotDescripciónSubtags
defaultoption component listOption Group / Option
header 2.4.3content at the top of the dropdown
footer 2.4.3content at the bottom of the dropdown
prefixcontenido prefix de un Select
emptyLista sin opciones
tag 2.5.0content as Select tag
loading 2.5.2content as Select loading

Select Exposes

MethodDescripciónTipo
focusfocus the Input componentFunction
blurblur the Input component, and hide the dropdownFunction

Option Group API

Option Group Attributes

NombreDescripciónTypeDefault
labelname of the groupstring
disabledwhether to disable all options in this groupbooleanfalse

Option Group Slots

NombreDescripciónSubtags
defaultcustomize default contentOption

Option API

Option Attributes

NameDescriptionTypeDefault
valuevalue of optionstring / number / boolean / object
labellabel of option, same as value if omittedstring / number
disabledwhether option is disabledbooleanfalse

Option Slots

NameDescripción
defaultcustomize default content

Fuente

ComponentesDocumentación

Contribuidores