Yt-UI
首页
快速开始
组件文档
首页
快速开始
组件文档
  • 表单组件

    • 输入框 Input
    • 多行输入框 Textarea
    • 开关 Switch
    • 多选框组 CheckboxGroup
    • 单选框组 RadioGroup
    • 滑块 Slider
    • 选择器 Picker
    • 日历 Calendar
    • 表单 Form
  • 展示组件

    • 头像 Avatar
    • 徽标 Badge
    • 卡片 Card
    • 标签 Tag
    • 步骤条 Steps
    • 结果页 Result
    • 空状态 Empty
    • 虚拟列表 VirtualList
  • 交互组件

    • 按钮 Button
    • 悬浮按钮 FAB
    • 图标 Icon
    • 搜索 Search
    • 分段器 Segment
    • 轮播 Swiper
    • 指示点 Dots
  • 反馈组件

    • 加载 Loading
    • 弹窗 Popup
    • 遮罩层 Overlay
    • 通告栏 NoticeBar
  • 导航组件

    • 标签栏 Tabbar
    • 顶部标签栏 TopTabbar
    • 折叠面板 Collapse
    • 课程表 Schedule
  • 布局组件

    • 分割线 Divider
    • 链接 Line
    • 可移动视图 MovableView

yt-search 搜索组件

属性

属性名类型默认值说明
themeThemeColor | 'none''none'主题颜色
modelValuestring''绑定值 (v-model)
valuestring''搜索值
placeholderstring'请输入搜索内容'占位文本
disabledbooleanfalse是否禁用
focusbooleanfalse是否自动聚焦
autoBlurbooleantrue点击页面是否自动收起键盘
showButtonbooleantrue是否显示搜索按钮

主题颜色

<yt-search theme="forest" />

<yt-search theme="ocean" />

<yt-search theme="magic" />

<yt-search theme="blossom" />

<yt-search theme="sunshine" />

<yt-search theme="classic" />

<yt-search theme="forest-sky" />

<yt-search theme="ocean-sky" />

<yt-search theme="magic-sky" />

<yt-search theme="blossom-sky" />

<yt-search theme="sunshine-sky" />

事件

事件名参数说明
update:modelValuemodelValue: stringv-model 更新
inputvalue: any输入时触发
focus{ value: any; height: number }获得焦点时触发
blurvalue: any失去焦点时触发
confirmvalue: any点击键盘完成按钮
keyboardHeightChange{ height: number; duration: number }键盘高度变化
searchvalue: any点击搜索按钮

示例

基本搜索

<yt-search />

无按钮搜索

<yt-search :showButton="false" />

绑定数据

<yt-search v-model="keyword" />

自定义提示

<yt-search placeholder="搜索商品、品牌..." />

禁用状态

<yt-search :disabled="true" />

自动聚焦

<yt-search :focus="true" />

事件处理

<yt-search v-model="keyword" @input="handleInput" @search="handleSearch" @confirm="handleConfirm" />

完整示例

<yt-search
  v-model="searchText"
  theme="forest-sky"
  placeholder="请输入搜索内容"
  :showButton="true"
  :focus="true"
  @search="handleSearch"
  @confirm="handleSearch"
/>
最近更新:: 2026/3/9 19:16
Contributors: CHEEMS, 2126340634
Prev
图标 Icon
Next
分段器 Segment