Skip to content

Select ​

Basic usage ​

vue
<template>
  <lh-select v-model="value" :options="options" placeholder="Please select" />
</template>

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

const value = ref()
const options = [
  { label: 'Option one', value: 'a' },
  { label: 'Option two', value: 'b' },
  { label: 'Disabled item', value: 'c', disabled: true },
]
</script>

Clearable / filterable ​

vue
<template>
  <lh-select v-model="value" :options="options" clearable />
  <lh-select v-model="value" :options="options" filterable placement="bottom" />
</template>

Props ​

PropDescriptionTypeDefault
modelValue (v-model)Bound valueunknown—
optionsOption listLhSelectOption[]—
sizeSize'small' | 'medium' | 'large'—
disabledDisabledbooleanfalse
clearableClearablebooleanfalse
placeholderPlaceholder textstring—
filterableFilterable (on MP an input is provided inside the overlay)booleanfalse
placementOverlay position (12 positions)LhPlacement'bottom'
customClassCustom class namestring—
themeVarsComponent-level theme variablesRecord<string, string>—
sxQuick layout propsLhSxProps—

LhSelectOption ​

PropDescriptionType
labelDisplayed textstring
valueValueunknown
disabledDisabledboolean

Events ​

EventDescriptionCallback parameters
update:modelValueValue changed(value)
changeValue changed (including undefined when cleared)(value)
visible-changeOverlay visibility(visible: boolean)

Differences from the Vue3 version

  • The overlay goes through root-portal + two-frame asynchronous measurement positioning (not absolute positioning).
  • Keyboard navigation (↑↓ / Home / End) is H5-only; the Mini Program has no keyboard events, so it is removed at compile time — on MP the options can only be tapped.
  • The filter input of filterable is rendered inside the overlay on MP.