源码:
组件xml
-
+
JS:根据条件判断是否使用slot
Component({
properties: {
custBottom: {type: Boolean, value: false}
},
data: {},
lifetimes: {
attached() {
console.log(">>> 被页面调用", this.data)
}
},
methods: {
}
});
页面调用
TEST
组件加上多slot配置,置为true
options: { multipleSlots: true },
修改:
Component({
properties: {
custBottom: {type: Boolean, value: false}
},
options: {
multipleSlots: true //增加此配置slot
},
data: {},
lifetimes: {
attached() {
console.log(">>> 被页面调用", this.data)
}
},
methods: {
}
});
效果:slot出来了。