更新记录

1.0.0(2026-01-07) 下载此版本

master


平台兼容性

uni-app(4.13)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
-
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 快应用-华为 快应用-联盟
- - - - - - - - - -

其他

多语言 暗黑模式 宽屏模式
× ×

安装

在市场导入xf-pk-multi-modaluni_modules版本的即可,无需import

组件关联说明

代码演示

基本用法

  • 使用组件代码如下:

普通搜索单选

<template>
    <scroll-view class="xf-col-center" scroll-y>
        <h3>单选</h3>
        <view style="width: 100%;">
            //表单基础用法
            <xf-pk-multiple-select-modal required pickerTitle="表单标题" :apiFn="getList" v-model="selectedList" valueKey="id" labelKey="customerAddr" @confirm="confirm">
            </xf-pk-multiple-select-modal>

            //插槽用法
            <xf-pk-multiple-select-modal :apiFn="getList" v-model="selectedList" valueKey="id" labelKey="customerAddr" 
                v-model:show="show" @confirm="confirm">
                <template #content>
                    <xf-fm-multi-select title="插槽标题" @click="show = true" v-model="selectedList" valueKey="id" labelKey="customerAddr" ></xf-fm-multi-select>
                </template>
            </xf-pk-multiple-select-modal>
        </view>
    </scroll-view>
</template>

可搜可输入

<template>
    <scroll-view class="xf-col-center" scroll-y>
        <h3>单选</h3>
        <view style="width: 100%;">
            <xf-pk-multiple-select-modal required pickerTitle="表单标题" :apiFn="getList" v-model="selectedList"
                valueKey="id" labelKey="customerAddr" isSearchFirst @confirm="confirm">
            </xf-pk-multiple-select-modal>
        </view>
    </scroll-view>
</template>

自定义

<template>
    <scroll-view class="xf-col-center" scroll-y>
        <h3>单选</h3>
        <view style="width: 100%;">
            <xf-pk-multiple-select-modal required pickerTitle="表单标题" :apiFn="getList" v-model="selectedList"
                valueKey="id" labelKey="customerAddr"  @confirm="confirm">
                <template #keyin>
                    <text style="margin-right: 16px;" @click="selfClick">自定义</text>
                </template>
            </xf-pk-multiple-select-modal>
        </view>
    </scroll-view>
</template>
<script setup lang="ts">
    import { onMounted, ref, watch } from 'vue';

    const show = ref(false)
    const selectedList = ref([])
    const list = ref([])
    const confirm = (e) => {
        console.log(selectedList)
    }

    const getList = (search : string,page:number)=>{
        createList()
        return new Promise((resolve)=>{
            setTimeout(()=>{
                let newList = list.value.filter(item=>{
                    if(search){
                        return item.customerAddr.includes(search)
                    }
                    else 
                    return true
                }).filter((item,index)=> {
                return index < page*20 && index >= (page-1)*20
                })
            let result = {
                total: newList.length,
                list: newList
            }
                resolve(result)
            },1000)
        })
    }

    const createList = ()=>{
        if(list.value.length > 0 )
            return
            for(let i = 0;i < 102;i++){
                list.value.push({
                    id: (i + 1) + "",
                    customerAddr: "人力二部" + i
                })
        }
    }
</script>

<style scoped lang="scss">
    view {
        margin-top: 10px;
    }
</style>

API

Props

属性名 说明 类型 默认值
v-model:modelValue 当前选中的对象列表 string -
v-model:show 自定义插槽时,是否打开弹窗 boolean false
pickerTitle 表单标题 string -
pickerBottomTip 表单标题下面提示语 object|string -
pickerTip 表单提示语 string -
searchPlaceholder 查询文案 string 请搜索
title 弹出层标题 string 请选择
tip 弹出层副标题 string -
apiFn 请求数据回调方法 object -
valueKey 列表对象value值对应的key string value
labelKey 列表对象label值对应的key string label
isSearchFirst 是否需要先搜索 boolean false
isShowSearch 是否展示搜索条件 boolean true
isPaging 是否分页 boolean true
pageSize 每页数据量 默认10 number -

事件 Emits

事件名 说明 返回值
confirm 点击确认按钮事件

插槽 slot

名称 说明 返回值
content 当不是表单组件时,用于自定义
keyin 左下角自定义操作插槽

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。