button.js 1002 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Component({
  2. properties: {
  3. //样式类型 primary, white, danger, warning, green,blue, gray,black
  4. type: {
  5. type: String,
  6. value: 'primary'
  7. },
  8. //是否加阴影 type =primary和 danger有效
  9. shadow: {
  10. type: Boolean,
  11. value: false
  12. },
  13. // 宽度 rpx或 %
  14. width: {
  15. type: String,
  16. value: '100%'
  17. },
  18. //高度 rpx
  19. height: {
  20. type: String,
  21. value: '94rpx'
  22. },
  23. //字体大小 rpx
  24. size: {
  25. type: Number,
  26. value: 32
  27. },
  28. //形状 circle(圆角), square(默认方形),rightAngle(平角)
  29. shape: {
  30. type: String,
  31. value: 'square'
  32. },
  33. plain: {
  34. type: Boolean,
  35. value: false
  36. },
  37. disabled: {
  38. type: Boolean,
  39. value: false
  40. },
  41. loading: {
  42. type: Boolean,
  43. value: false
  44. }
  45. },
  46. data: {
  47. },
  48. methods: {
  49. handleClick() {
  50. if (this.data.disabled) {
  51. return false;
  52. }
  53. this.triggerEvent('click', {})
  54. }
  55. }
  56. })