index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Component({
  2. behaviors: ['wx://form-field'],
  3. externalClasses: ['i-class'],
  4. properties: {
  5. title: {
  6. type: String
  7. },
  8. // text || textarea || password || number
  9. type: {
  10. type: String,
  11. value: 'text'
  12. },
  13. disabled: {
  14. type: Boolean,
  15. value: false
  16. },
  17. placeholder: {
  18. type: String,
  19. value: ''
  20. },
  21. autofocus: {
  22. type: Boolean,
  23. value: false
  24. },
  25. mode: {
  26. type: String,
  27. value: 'normal'
  28. },
  29. right: {
  30. type: Boolean,
  31. value: false
  32. },
  33. error: {
  34. type: Boolean,
  35. value: false
  36. },
  37. maxlength: {
  38. type: Number
  39. }
  40. },
  41. methods: {
  42. handleInputChange(event) {
  43. const { detail = {} } = event;
  44. const { value = '' } = detail;
  45. this.setData({ value });
  46. this.triggerEvent('change', event);
  47. },
  48. handleInputFocus(event) {
  49. this.triggerEvent('focus', event);
  50. },
  51. handleInputBlur(event) {
  52. this.triggerEvent('blur', event);
  53. }
  54. }
  55. });