Yao 49db8e944f
[improvement] Btn & Field: 支持原生属性 (#219)
* 增加 field 组件 submit 支持

* add new behavior

* 增加 btn 支持项

* btn 文档补齐
2018-05-04 22:47:12 +08:00

47 lines
803 B
JavaScript

Component({
behaviors: ['wx://form-field'],
properties: {
title: String,
type: {
type: String,
value: 'input'
},
disabled: Boolean,
inputType: {
type: String,
value: 'text'
},
placeholder: String,
focus: Boolean,
mode: {
type: String,
value: 'normal'
},
right: Boolean,
error: Boolean,
maxlength: {
type: Number,
value: 140
}
},
methods: {
handleFieldChange(event) {
const { detail = {} } = event;
const { value = '' } = detail;
this.setData({ value });
this.triggerEvent('change', event);
},
handleFieldFocus(event) {
this.triggerEvent('focus', event);
},
handleFieldBlur(event) {
this.triggerEvent('blur', event);
}
}
});