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
|
### 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 |
|
| 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
|
### API
|
||||||
|
Search support all native properties of input tag,such as `maxlength`、`placeholder`、`readonly`、`autofocus`
|
||||||
|
|
||||||
| Attribute | Description | Type | Default | Accepted Values |
|
| Attribute | Description | Type | Default | Accepted Values |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
@ -79,7 +79,7 @@ Vue.use(Field);
|
|||||||
```
|
```
|
||||||
|
|
||||||
### API
|
### API
|
||||||
Filed 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readonly` 等
|
Filed 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readonly`、`autofocus` 等
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
|
@ -46,10 +46,10 @@ Tips: 在 `van-search` 外层增加 form 标签,并且 action 不为空,即
|
|||||||
```
|
```
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
Search 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`placeholder`、`readony`、`autofocus` 等
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|
||||||
|-----------|-----------|-----------|-------------|-------------|
|
|-----------|-----------|-----------|-------------|-------------|
|
||||||
| placeholder | `input`的`placeholder`文案 | `String` | - | - |
|
|
||||||
| background | 搜索框背景色 | `String` | `#f2f2f2` | 所有浏览器支持的颜色描述 |
|
| background | 搜索框背景色 | `String` | `#f2f2f2` | 所有浏览器支持的颜色描述 |
|
||||||
| showAction | 是否在搜索框右侧显示取消按钮 | `Boolean` | false | - |
|
| showAction | 是否在搜索框右侧显示取消按钮 | `Boolean` | false | - |
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@
|
|||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
class="van-search__input"
|
class="van-search__input"
|
||||||
|
v-bind="$attrs"
|
||||||
v-refocus="focusStatus"
|
v-refocus="focusStatus"
|
||||||
:value="value"
|
:value="value"
|
||||||
:placeholder="placeholder"
|
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
@keypress.enter.prevent="onSearch"
|
@keypress.enter.prevent="onSearch"
|
||||||
>
|
>
|
||||||
<icon name="clear" @click="onClean" v-show="isFocus" />
|
<icon name="clear" v-show="isFocus && value" @click="onClean" />
|
||||||
</div>
|
</div>
|
||||||
<div class="van-search__action" v-if="showAction">
|
<div class="van-search__action" v-if="showAction">
|
||||||
<slot name="action">
|
<slot name="action">
|
||||||
@ -35,7 +35,6 @@ export default create({
|
|||||||
props: {
|
props: {
|
||||||
value: String,
|
value: String,
|
||||||
showAction: Boolean,
|
showAction: Boolean,
|
||||||
placeholder: String,
|
|
||||||
background: {
|
background: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#f2f2f2'
|
default: '#f2f2f2'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user