// myComponents/formItem/formItem.js Component({ options:{ multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, /** * 组件的属性列表 */ properties: { label:{ type:String, value:'' }, labelWidth:{ type:Number, value:'', }, labelPosition:{ type:String, value:'left' }, customClass:{ type:String, value:'' }, customStyle:{ type:String, value:'' }, required:{ type:Boolean, value:false }, border:{ type:Boolean, value:true } }, /** * 组件的初始数据 */ data: { }, lifetimes: { // 在组件实例进入页面节点树时执行 attached: function () { // 初始化操作 // console.log('组件初始化'); // ... }, // 在组件实例被移除出页面节点树时执行 detached: function () { // 清理工作 console.log('组件销毁'); // ... }, // ... }, /** * 组件的方法列表 */ methods: { } })