formItem.js 952 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. },
  27. /**
  28. * 组件的初始数据
  29. */
  30. data: {
  31. },
  32. lifetimes: {
  33. // 在组件实例进入页面节点树时执行
  34. attached: function () {
  35. // 初始化操作
  36. // console.log('组件初始化');
  37. // ...
  38. },
  39. // 在组件实例被移除出页面节点树时执行
  40. detached: function () {
  41. // 清理工作
  42. console.log('组件销毁');
  43. // ...
  44. },
  45. // ...
  46. },
  47. /**
  48. * 组件的方法列表
  49. */
  50. methods: {
  51. }
  52. })