mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Search: support native input attrs (#418)
This commit is contained in:
parent
e2318391dc
commit
1fd157e9f4
@ -77,7 +77,7 @@ Textarea Filed can be auto resize when has `autosize` prop
|
||||
```
|
||||
|
||||
### API
|
||||
Filed support all native properties of input tag,such as `maxlength`、`placeholder`、`readonly`
|
||||
Filed support all native properties of input tag,such as `maxlength`、`placeholder`、`readonly`、`autofocus`
|
||||
|
||||
| Attribute | Description | Type | Default | Accepted Values |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
|
@ -55,6 +55,7 @@ Use `action` slot to custom right button, `cancel` event will no longer be trigg
|
||||
```
|
||||
|
||||
### API
|
||||
Search support all native properties of input tag,such as `maxlength`、`placeholder`、`readonly`、`autofocus`
|
||||
|
||||
| Attribute | Description | Type | Default | Accepted Values |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
|
@ -79,7 +79,7 @@ Vue.use(Field);
|
||||
```
|
||||
|
||||
### API
|
||||
Filed 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readonly` 等
|
||||
Filed 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readonly`、`autofocus` 等
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
|
@ -46,10 +46,10 @@ Tips: 在 `van-search` 外层增加 form 标签,并且 action 不为空,即
|
||||
```
|
||||
|
||||
### API
|
||||
Search 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readony`、`autofocus` 等
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||
|-----------|-----------|-----------|-------------|-------------|
|
||||
| placeholder | `input`的`placeholder`文案 | `String` | - | - |
|
||||
| background | 搜索框背景色 | `String` | `#f2f2f2` | 所有浏览器支持的颜色描述 |
|
||||
| showAction | 是否在搜索框右侧显示取消按钮 | `Boolean` | false | - |
|
||||
|
||||
|
@ -8,14 +8,14 @@
|
||||
<input
|
||||
type="search"
|
||||
class="van-search__input"
|
||||
v-bind="$attrs"
|
||||
v-refocus="focusStatus"
|
||||
:value="value"
|
||||
:placeholder="placeholder"
|
||||
@input="onInput"
|
||||
@focus="onFocus"
|
||||
@keypress.enter.prevent="onSearch"
|
||||
>
|
||||
<icon name="clear" @click="onClean" v-show="isFocus" />
|
||||
<icon name="clear" v-show="isFocus && value" @click="onClean" />
|
||||
</div>
|
||||
<div class="van-search__action" v-if="showAction">
|
||||
<slot name="action">
|
||||
@ -35,7 +35,6 @@ export default create({
|
||||
props: {
|
||||
value: String,
|
||||
showAction: Boolean,
|
||||
placeholder: String,
|
||||
background: {
|
||||
type: String,
|
||||
default: '#f2f2f2'
|
||||
|
Loading…
x
Reference in New Issue
Block a user