更新记录
1.0.0(2026-01-05)
下载此版本
master
平台兼容性
uni-app(4.13)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
√ |
√ |
√ |
- |
√ |
√ |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
安装
在市场导入xf-searchuni_modules版本的即可,无需import
组件关联说明
代码演示
基本用法
<template>
<view class="xf-col main-page" style="gap: 10px;">
<text>搜索 S1 :简单搜索</text>
<xf-search v-model="searchText" placeholder="搜索客户、业务" @search="onSearch"></xf-search>
<xf-search v-model="searchText" placeholder="搜索客户、业务" hasSearchBtn @search="onSearch"></xf-search>
<text>带筛选搜索</text>
<xf-search v-model="searchText" placeholder="搜索客户、业务" isFilter @search="onSearch" @handleFilter="handleFilter">
</xf-search>
<text>筛选后状态</text>
<xf-search v-model="searchText" placeholder="搜索客户、业务" isFilter isFiltered @search="onSearch"
@handleFilter="handleFilter">
</xf-search>
<xf-search v-model="searchText" hasSearchBtn placeholder="搜索客户、业务" isFilter isFiltered @search="onSearch"
@handleFilter="handleFilter">
</xf-search>
</view>
</template>
<script setup lang="ts">
// 搜索页面
import { computed, ref } from 'vue'
const searchText = ref('')
const onSearch = (e) => {
console.log(e)
}
const handleFilter = (e) => {
console.log(e)
}
</script>
API
Props
| 属性名 |
说明 |
类型 |
默认值 |
| v-model:modelValue |
当前搜索内容 |
string |
- |
| customClass |
自定义class |
string |
- |
| customStyle |
自定义style |
string|object |
- |
| placeholder |
占位字符 |
string |
搜索 |
| isFilter |
是否显示 筛选 按钮 |
boolean |
false |
| isFiltered |
是否 筛选 是否 选中 |
boolean |
false |
| hasSearchBtn |
是否显示搜索按钮 |
boolean |
false |
事件 Emits
| 事件名 |
说明 |
返回值 |
| search |
点击搜索/点击键盘搜索回调事件 |
|
| change |
当前搜索内容变化事件 |
|
| handleFilter |
点击筛选回调事件 |
|