feat(Search): add action-text prop (#2057)

This commit is contained in:
neverland 2019-09-19 11:26:45 +08:00 committed by GitHub
parent 31558541c2
commit 86ed4f6b3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 1 deletions

View File

@ -61,6 +61,7 @@
| value | 当前输入的值 | *string \| number* | - | - | | value | 当前输入的值 | *string \| number* | - | - |
| background | 搜索框背景色 | *string* | `#f2f2f2` | - | | background | 搜索框背景色 | *string* | `#f2f2f2` | - |
| show-action | 是否在搜索框右侧显示取消按钮 | *boolean* | `false` | - | | show-action | 是否在搜索框右侧显示取消按钮 | *boolean* | `false` | - |
| action-text | 取消按钮文字 | *boolean* | `取消` | 1.0.0 |
| focus | 获取焦点 | *boolean* | `false` | - | | focus | 获取焦点 | *boolean* | `false` | - |
| error | 是否将输入内容标红 | *boolean* | `false` | - | | error | 是否将输入内容标红 | *boolean* | `false` | - |
| disabled | 是否禁用输入框 | *boolean* | `false` | - | | disabled | 是否禁用输入框 | *boolean* | `false` | - |

View File

@ -17,6 +17,10 @@ VantComponent({
useActionSlot: Boolean, useActionSlot: Boolean,
placeholder: String, placeholder: String,
placeholderStyle: String, placeholderStyle: String,
actionText: {
type: String,
value: '取消'
},
background: { background: {
type: String, type: String,
value: '#ffffff' value: '#ffffff'

View File

@ -41,6 +41,6 @@
hover-stay-time="70" hover-stay-time="70"
> >
<slot wx:if="{{ useActionSlot }}" name="action" /> <slot wx:if="{{ useActionSlot }}" name="action" />
<view wx:else bind:tap="onCancel" class="cancel-class">取消</view> <view wx:else bind:tap="onCancel" class="cancel-class">{{ actionText }}</view>
</view> </view>
</view> </view>