formItem.js 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // myComponents/formItem/formItem.js
  2. Component({
  3. options:{
  4. multipleSlots: true // 在组件定义时的选项中启用多slot支持
  5. },
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. label:{
  11. type:String,
  12. value:''
  13. },
  14. labelWidth:{
  15. type:Number,
  16. value:'',
  17. },
  18. labelPosition:{
  19. type:String,
  20. value:'left'
  21. },
  22. customClass:{
  23. type:String,
  24. value:''
  25. },
  26. required:{
  27. type:Boolean,
  28. value:false
  29. }
  30. },
  31. /**
  32. * 组件的初始数据
  33. */
  34. data: {
  35. },
  36. lifetimes: {
  37. // 在组件实例进入页面节点树时执行
  38. attached: function () {
  39. // 初始化操作
  40. // console.log('组件初始化');
  41. // ...
  42. },
  43. // 在组件实例被移除出页面节点树时执行
  44. detached: function () {
  45. // 清理工作
  46. console.log('组件销毁');
  47. // ...
  48. },
  49. // ...
  50. },
  51. /**
  52. * 组件的方法列表
  53. */
  54. methods: {
  55. }
  56. })