ASEMiniProgram/dist/input/index.js

62 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-03-20 17:48:56 +00:00
Component({
behaviors: ['wx://form-field'],
externalClasses: ['i-class'],
properties: {
title: {
type: String
},
// text || textarea || password || number
type: {
type: String,
value: 'text'
},
disabled: {
type: Boolean,
value: false
},
placeholder: {
type: String,
value: ''
},
autofocus: {
type: Boolean,
value: false
},
mode: {
type: String,
value: 'normal'
},
right: {
type: Boolean,
value: false
},
error: {
type: Boolean,
value: false
},
maxlength: {
type: Number
}
},
methods: {
handleInputChange(event) {
const { detail = {} } = event;
const { value = '' } = detail;
this.setData({ value });
this.triggerEvent('change', event);
},
handleInputFocus(event) {
this.triggerEvent('focus', event);
},
handleInputBlur(event) {
this.triggerEvent('blur', event);
}
}
});