Skip to content

t-picker-select

PickerSelect 下拉选择器

组件介绍

t-picker-select 是选择列表组件,适用于移动端,支持单选和多选,支持搜索过滤功能。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

基础用法参考 demo/picker-select/picker-select.uvue,通过 v-model 绑定选中的值。

vue
<template>
  <!-- 单选 -->
  <t-picker-select 
    v-model="selectedValue"
    :list="options"
    labelKey="name"
    valueKey="id"
    :singled="true"
    placeholder="请选择"
    @confirm="onConfirm">
  </t-picker-select>

  <!-- 多选 -->
  <t-picker-select 
    v-model="selectedValues"
    :list="options"
    labelKey="name"
    valueKey="id"
    :singled="false"
    placeholder="请选择(多选)"
    @confirm="onConfirm">
  </t-picker-select>
</template>

<script setup>
const selectedValue = ref([])
const selectedValues = ref([])

const options = ref([
  { id: '1', name: '选项一' },
  { id: '2', name: '选项二' },
  { id: '3', name: '选项三' }
])

function onConfirm(result: any) {
  console.log('选中的值:', result)
}
</script>

Props

属性名说明类型默认值
modelValue双向绑定的值string[][]
list数据源UTSJSONObject[][]
labelKey显示字段名string-
valueKey值字段名string-
singled是否单选booleantrue
title标题string-
placeholder占位文字string'请选择'
embeddable是否嵌入页面booleanfalse
contentClass内容区样式string-
path点击组件后跳转的页面路径string''
hover是否启用点击效果booleanfalse
type组件主题类型string''
disabled是否禁用booleanfalse
effect组件显示主题string'normal'
size组件尺寸string'mini'

Events

事件名说明回调参数
confirm点击确认按钮时触发value: string[]
change值变化时触发value: string[]
cancel点击取消按钮时触发-

Slots

插槽名说明
default默认插槽,自定义触发按钮