# uni-search-bar
## Instructions
组件名:uni-search-bar
代码块: uSearchBar
点击下载&安装
### Syntax
- 使用 ``(或 ``,当需要包裹子节点时)。
- 遇到平台差异时,建议使用条件编译(`#ifdef / #endif`)显式处理。
#### Properties
| 属性名 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| value/v-model | StringNumber | | 搜索栏绑定值 |
| placeholder | String | 搜索 | 搜索栏Placeholder |
| radius | Number | 10 | 搜索栏圆角,单位px |
| clearButton | String | auto | 是否显示清除按钮,可选值 always -一直显示、 auto -输入框不为空时显示、 none -一直不显示 |
| cancelButton | String | auto | 是否显示取消按钮,可选值 always -一直显示、 auto -输入框不为空时显示、 none -一直不显示 |
| cancelText | String | 取消 | 取消按钮的文字 |
| bgColor | String | #F8F8F8 | 输入框背景颜色 |
| textColor | String | #F8F8F8 | 输入时文字颜色 |
| maxlength | Number | 100 | 输入最大长度 |
| focus | Boolean | false | |
#### Events
| 事件称名 | 说明 | 返回参数 |
| --- | --- | --- |
| @confirm | uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value | e={value:Number} |
| @input | uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value | e=value |
| @cancel | 点击取消按钮时触发事件,返回参数为uniSearchBar的value | e={value:Number} |
| @clear | 点击清除按钮时触发事件,返回参数为uniSearchBar的value | e={value:Number} |
| @focus | input 获取焦点时触发事件,返回参数为uniSearchBar的value | e={value:Number} |
| @blur | input 失去焦点时触发事件,返回参数为uniSearchBar的value | e={value:Number} |
#### Platform Compatibility
See official docs for platform support table: `https://uniapp.dcloud.net.cn/component/uniui/uni-search-bar.html`
### Examples
### Example (Example 1)
```vue
```
### Example (Example 2)
```html
```
### Example (Example 3)
```vue
X
```
### Example (Example 4)
```html
X
```
### Example (Example 5)
```vue
搜索栏组件,通常用于搜索商品、文章等。
当前输入为:{{ searchValue }}
```
### Example (Example 6)
```html
搜索栏组件,通常用于搜索商品、文章等。
当前输入为:{{ searchValue }}
```
Reference:
- [Official Documentation](https://uniapp.dcloud.net.cn/component/uniui/uni-search-bar.html)
- [Plugin Marketplace](https://ext.dcloud.net.cn/plugin?name=search-bar)
- [Local Example](examples/uni-ui/uni-search-bar.vue)