diff --git a/example/pages/field/config.js b/example/pages/field/config.js index 7b63a6be..2d15a321 100644 --- a/example/pages/field/config.js +++ b/example/pages/field/config.js @@ -2,6 +2,7 @@ module.exports = { // 基础类型输入框配置 base: { name: { + focus: true, title: '收货人', placeholder: '名字' }, diff --git a/packages/field/README.md b/packages/field/README.md index a7b27cca..dcf98e33 100644 --- a/packages/field/README.md +++ b/packages/field/README.md @@ -59,6 +59,7 @@ Page(extend({}, Field, { | type | 输入框的类型,可选值为 input, textarea | String | input | | | inputType | 输入框为 input 情况下,输入框的类型,例如:number, text, password | String | text | | | placeholder | 输入框为空时占位符 | String | | | +| focus | 自动聚焦,拉起键盘 | Boolean | false | | | mode | 输入框展示样式,可选值为 wrapped, normal | String | normal | | | right | 输入框内容是否居右显示 | Boolean | false | | | error | 是否显示为输入框错误情况下的样式 | Boolean | false | | diff --git a/packages/field/index.wxml b/packages/field/index.wxml index beb3ca3b..3bac95ab 100644 --- a/packages/field/index.wxml +++ b/packages/field/index.wxml @@ -8,6 +8,7 @@ auto-height name="{{ name || componentId || '' }}" value="{{ value }}" + focus="{{ focus }}" placeholder="{{ placeholder }}" class="zan-field__input zan-cell__bd {{ right ? 'zan-field__input--right' : '' }}" placeholder-class="zan-field__placeholder" @@ -20,6 +21,7 @@ type="{{ inputType || 'text' }}" name="{{ name || componentId || '' }}" value="{{ value }}" + focus="{{ focus }}" placeholder="{{ placeholder }}" class="zan-field__input zan-cell__bd {{ right ? 'zan-field__input--right' : '' }}" placeholder-class="zan-field__placeholder"