diff --git a/src/search/README.md b/src/search/README.md index 0b5ebfcaa..94e93c653 100644 --- a/src/search/README.md +++ b/src/search/README.md @@ -88,7 +88,7 @@ export default { ### Custom Action Button -Use `action` slot to custom right button, `cancel` event will no longer be triggered when use this slot +Use `action` slot to custom right button, `cancel` event will no longer be triggered when use this slot. ```html @@ -21,7 +21,7 @@ v-model 用于控制搜索框中的文字,background 可以自定义搜索框 ### 事件监听 -Search 组件提供了`search`和`cancel`事件,`search`事件在点击键盘上的搜索/回车按钮后触发,`cancel`事件在点击搜索框右侧取消按钮时触发 +Search 组件提供了 `search` 和 `cancel` 事件,`search` 事件在点击键盘上的搜索/回车按钮后触发,`cancel` 事件在点击搜索框右侧取消按钮时触发。 ```html
@@ -55,11 +55,11 @@ export default { }; ``` -> Tips: 在 van-search 外层增加 form 标签,且 action 不为空,即可在 iOS 输入法中显示搜索按钮 +> Tips: 在 van-search 外层增加 form 标签,且 action 不为空,即可在 iOS 输入法中显示搜索按钮。 ### 搜索框内容对齐 -通过 `input-align` 属性设置搜索框内容的对齐方式,可选值为`center`、`right` +通过 `input-align` 属性设置搜索框内容的对齐方式,可选值为 `center`、`right`。 ```html @@ -79,7 +79,7 @@ export default { ### 自定义背景色 -通过`background`属性可以设置搜索框外部的背景色,通过`shape`属性设置搜索框的形状,可选值为`round` +通过 `background` 属性可以设置搜索框外部的背景色,通过 `shape` 属性设置搜索框的形状,可选值为 `round`。 ```html `focus` 表示输入框聚焦且不为空时展示 | _string_ | `focus` | | autofocus | 是否自动聚焦,iOS 系统不支持该属性 | _boolean_ | `false` | | show-action | 是否在搜索框右侧显示取消按钮 | _boolean_ | `false` | | action-text `v2.2.2` | 取消按钮文字 | _boolean_ | `取消` | diff --git a/src/search/index.tsx b/src/search/index.tsx index a2325d457..2068174cc 100644 --- a/src/search/index.tsx +++ b/src/search/index.tsx @@ -22,6 +22,7 @@ export type SearchProps = { background: string; actionText?: string; showAction?: boolean; + clearTrigger?: string; }; export type SearchSlots = DefaultSlots & { @@ -110,6 +111,7 @@ function Search( leftIcon={props.leftIcon} rightIcon={props.rightIcon} clearable={props.clearable} + clearTrigger={props.clearTrigger} scopedSlots={{ 'left-icon': slots['left-icon'], 'right-icon': slots['right-icon'], @@ -127,8 +129,9 @@ Search.props = { label: String, rightIcon: String, actionText: String, - showAction: Boolean, background: String, + showAction: Boolean, + clearTrigger: String, shape: { type: String, default: 'square',