更新记录
1.0.0.5(2026-01-07) 下载此版本
master
1.0.0.4(2026-01-07) 下载此版本
master
1.0.0.3(2026-01-07) 下载此版本
master
查看更多平台兼容性
uni-app(4.13)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| √ | √ | √ | √ | √ | - | √ | √ | √ |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| √ | - | - | - | - | - | - | - | - | - | - | - |
其他
| 多语言 | 暗黑模式 | 宽屏模式 |
|---|---|---|
| × | × | √ |
安装
在市场导入xf-pk-single-select uni_modules版本的即可,无需import
组件关联说明
代码演示
基本用法
- 基础页面使用组件代码如下:
表单通用
<template>
<scroll-view class="xf-col-center" scroll-y>
<h3>单选</h3>
<view style="width: 100%;">
<xf-pk-single-select pickerTitle="F1无按钮" :hasFooterBtn="showFooterBtn" :list="singleLists" v-model:modelValue="selectedValue"
@confirm="confirm">
</xf-pk-single-select>
</view>
</scroll-view>
</template>
当不在表单中使用时,用如下插槽用法;
<template>
<scroll-view class="xf-col-center" scroll-y>
<h3>单选</h3>
<view style="width: 100%;">
<xf-pk-single-select :hasFooterBtn="showFooterBtn" :list="singleLists" v-model:modelValue="selectedValue"
v-model:show="show" @confirm="confirm">
<template #content>
<xf-fm-select title="标题" @click="show = true" v-model:value="selectedValue"> </xf-fm-select>
</template>
</xf-pk-single-select>
</view>
</scroll-view>
</template>
<script setup lang="ts">
import { onReady, onShow, onBackPress } from '@dcloudio/uni-app'
import { onMounted, ref, watch } from 'vue';
const confirm = (e)=>{
console.log(selectedValue.value)
console.log(e)
}
const show = ref(false)
const selectedValue = ref(1)
const showFooterBtn = ref(true)
const singleLists = ref([
{
label: '选项1',
value: 1,
},
{
label: '选项2',
value: 2
},
{
label: '选项3',
value: 3
},
{
label: '选项4',
value: 4
},
{
label: '选项5',
value: 5
},
{
label: '选项6',
value: 6
},
]);
</script>
<style scoped lang="scss">
view {
margin-top: 10px;
}
</style>
API
Props
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| v-model:modelValue | 当前选中的value | string | - |
| v-model:show | 自定义插槽时,是否打开弹窗 | boolean | false |
| pickerTitle | 表单标题 | string | - |
| pickerBottomTip | 表单标题下面提示语 | object|string |
- |
| pickerTip | 表单提示语 | string | - |
| required | *是否必填 | boolean | false |
| list | 展示列表 | string | - |
| title | 弹框标题 | string | - |
| valueKey | 列表对象value值对应的key | string | value |
| labelKey | 列表对象label值对应的key | string | label |
| tipKey | item副标题对应的key | string | tip |
| hasFooterBtn | 是否显示底部按钮 | boolean | false |
外部调用事件 Expose
| 事件名 | 说明 | 返回值 |
|---|---|---|
| confirm | 选中后回调事件 | 列表中的对象 |
插槽 slot
| 名称 | 说明 | 返回值 |
|---|---|---|
| content | 当不是表单组件时,用于自定义 |

收藏人数:
下载插件并导入HBuilderX
赞赏(0)
下载 302
赞赏 0
下载 11234677
赞赏 1860
赞赏
京公网安备:11010802035340号