Skip to content

t-picker-city

PickerCity 城市选择器

组件介绍

t-picker-city 是自带全国城市数据的选择组件,支持省市区三级联动选择,可嵌入页面或弹窗模式使用。

平台兼容

HarmonyH5AndroidiOS小程序UTS

基础用法

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

vue
<template>
  <t-picker-city 
    v-model="selectedCity"
    title="选择地区"
    placeholder="请选择省市区"
    @confirm="onConfirm">
  </t-picker-city>
</template>

<script setup>
const selectedCity = ref({
  ids: [],
  values: []
})

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

Props

属性名说明类型默认值
modelValue双向绑定的值string[][]
list城市数据源UTSJSONObject[]-
title标题string'地区'
titleClass标题样式string-
labelClass副标题样式string-
placeholder占位文字string'请选择'
embeddable是否嵌入页面booleanfalse
border是否显示边框booleanfalse
popupAttrst-popup 的属性UTSJSONObject-
path点击组件后跳转的页面路径string''
hover是否启用点击效果booleanfalse
type组件主题类型string''
disabled是否禁用booleanfalse
effect组件显示主题string'normal'
size组件尺寸string'mini'

Events

事件名说明回调参数
confirm点击确认按钮时触发{ ids, values }
change值变化时触发{ ids, values }
cancel点击取消按钮时触发-

Slots

插槽名说明
button自定义触发按钮