index.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // components/diy-area/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. options: {
  7. multipleSlots: true, // 在组件定义时的选项中启用多slot支持
  8. /* options: null, */
  9. },
  10. properties: {
  11. active: {
  12. type: Number,
  13. value: 1,
  14. },
  15. txtfontsize: {
  16. type: Number,
  17. value: 32,
  18. },
  19. txtcolor: {
  20. type: String,
  21. value: "#000000",
  22. },
  23. width: {
  24. type: Number,
  25. value: 690,
  26. },
  27. border: {
  28. type: String,
  29. value: "5rpx solid #f6f6f6",
  30. },
  31. borderradius: {
  32. type: Number,
  33. value: 30,
  34. },
  35. txtmargin: {
  36. type: String,
  37. value: "0rpx 0rpx 20rpx 30rpx",
  38. },
  39. margin: {
  40. type: String,
  41. value: "0rpx 0rpx 0rpx 30rpx",
  42. },
  43. padding: {
  44. type: String,
  45. value: "0rpx 0rpx 0rpx 0rpx",
  46. },
  47. txt: {
  48. type: String,
  49. value: "所在地区:",
  50. },
  51. inputcolor: {
  52. type: String,
  53. value: "#000000",
  54. },
  55. inputfontsize: {
  56. type: Number,
  57. value: 32,
  58. },
  59. inputmargin: {
  60. type: String,
  61. value: "0rpx 0rpx 20rpx 30rpx",
  62. },
  63. region: {
  64. type: Array,
  65. value: ['江西省', '南昌市', '东湖区'],
  66. }
  67. },
  68. /**
  69. * 组件的初始数据
  70. */
  71. data: {
  72. /* region: ['江西省', '南昌市', '东湖区'], // 初始值 (data内) */
  73. },
  74. /**
  75. * 组件的方法列表
  76. */
  77. methods: {
  78. bindRegionChange: function(e) { // picker值发生改变都会触发该方法
  79. console.log('picker发送选择改变,携带值为', e.detail.value)
  80. this.triggerEvent('comclick', e.detail.value)
  81. this.setData({
  82. region: e.detail.value
  83. })
  84. },
  85. }
  86. })