index.js 1.4 KB

1
  1. import eventBus from"../utils/eventBus.js";Component({options:{multipleSlots:!0},behaviors:["wx://form-field"],externalClasses:["l-class","l-label-class","l-error-text","l-error-text-class"],properties:{label:{type:String,value:""},hideLabel:{type:Boolean,value:!1},labelCustom:{type:Boolean,value:!1},showRow:{type:Boolean,value:!0},required:{type:Boolean,value:!1},placeholder:{type:String,value:""},type:{type:String,value:"text"},value:{type:String,value:""},colon:{type:Boolean,value:!1},focus:{type:Boolean,value:!1},clear:{type:Boolean,value:!1},maxlength:{type:Number,value:140},width:{type:Number,value:750},labelWidth:{type:Number,value:200},labelLayout:{type:String,value:"left"},disabled:{type:Boolean,value:!1},placeholderStyle:{type:String,value:""}},data:{},attached(){},methods:{handleInputChange(e){const{detail:t={}}=e,{value:l=""}=t;this.setData({value:l}),eventBus.emit(`lin-form-change-${this.id}`,this.id),this.triggerEvent("lininput",e.detail)},handleInputFocus(e){this.triggerEvent("linfocus",e.detail)},handleInputBlur(e){eventBus.emit(`lin-form-blur-${this.id}`,this.id),this.triggerEvent("linblur",e.detail)},handleInputConfirm(e){const{detail:t={}}=e,{value:l=""}=t;this.setData({value:l}),this.triggerEvent("linconfirm",e.detail)},onClearTap(e){this.setData({value:""}),this.triggerEvent("linclear",e.detail)},getValues(){return this.data.value},reset(){this.setData({value:""})}}});