# 4.20 搜索栏(Searchbar)
搜索栏组件,用于页面内的搜索功能
# 基础用法
<template>
<dof-searchbar placeholder="搜索" @dofSearchbarInput="onInput"></dof-searchbar>
</template>
1
2
3
2
3
# Attributes
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
placeholder | String | N | 搜索 | 输入框占位文本 |
default-value | String | N | '' | 默认值 |
disabled | Boolean | N | false | 是否禁用 |
input-type | String | N | text | 输入框类型 |
return-key-type | String | N | search | 回车键类型 |
mod | String | N | default | 模式 |
autofocus | Boolean | N | false | 是否自动聚焦 |
theme | String | N | white | 主题 |
bar-style | Object | N | {} | 搜索栏自定义样式 |
show-right-content | Boolean | N | false | 是否显示右侧内容 |
right-label | String | N | 搜索 | 右侧文本 |
back-arrow | Boolean | N | false | 是否显示返回箭头 |
list | Array | N | [] | 搜索建议列表 |
selected-text | String | N | '' | 选中文本 |
input-width | Number | N | 0 | 输入框宽度 |
needDarkMode | Boolean | N | false | 是否需要暗黑模式适配 ^2.5.5 |
# Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
dofSearchbarInput | 输入事件 | e |
dofSearchbarSubmit | 提交事件 | e |
dofSearchbarCancel | 取消事件 | - |