formItem.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. customStyle:{
  27. type:String,
  28. value:''
  29. },
  30. required:{
  31. type:Boolean,
  32. value:false
  33. },
  34. border:{
  35. type:Boolean,
  36. value:true
  37. }
  38. },
  39. /**
  40. * 组件的初始数据
  41. */
  42. data: {
  43. },
  44. lifetimes: {
  45. // 在组件实例进入页面节点树时执行
  46. attached: function () {
  47. // 初始化操作
  48. // console.log('组件初始化');
  49. // ...
  50. },
  51. // 在组件实例被移除出页面节点树时执行
  52. detached: function () {
  53. // 清理工作
  54. console.log('组件销毁');
  55. // ...
  56. },
  57. // ...
  58. },
  59. /**
  60. * 组件的方法列表
  61. */
  62. methods: {
  63. }
  64. })