import child from "./child";
export default {
data() {
return {
info: {
title: "标题一"
},
info2: {
title: "标题二"
}
};
},
render() {
return (
<child
scopedSlots={{
default: props => {
return
{props.info.title}
;
},
other: props => {
return
{props.info.title}
;
}
}}
/>
);
}
};
<child
scopedSlots={{
default: props => {
return
{props.info.title}
;
},
other: props => {
return
{props.info.title}
;
}
}}
/>
写了slots了
this.$scopedSlots.default({}) //子组件传递值给父组件 默认
this.$scopedSlots.other({}) :具名插槽
this.$slots()
具名插槽,没有值
父组件 scopedSlots={{
footer: () => {
return
footer
;
}
}}
子组件{this.$scopedSlots.footer()}