myButton.js 787 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // components/myButton/myButton.js
  2. Component({
  3. options: {
  4. styleIsolation: 'apply-shared'
  5. },
  6. behaviors: ['wx://form-field-button'],
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {
  11. size: String,
  12. type: String,
  13. disabled: Boolean,
  14. formType: String,
  15. openType: String
  16. },
  17. lifetimes: {
  18. attached: function () {
  19. if (this.data.type !== 'default' && this.data.type !== 'primary') {
  20. this.setData({
  21. type: 'default'
  22. })
  23. }
  24. if (this.data.size !== 'default' && this.data.size !== 'large' && this.data.size !== 'mini') {
  25. this.setData({
  26. size: 'default'
  27. })
  28. }
  29. }
  30. },
  31. /**
  32. * 组件的初始数据
  33. */
  34. data: {
  35. },
  36. /**
  37. * 组件的方法列表
  38. */
  39. methods: {
  40. }
  41. })