Ema*_*non 9 vue.js vue-component vuejs2
我有一种情况,我有一个渲染功能,将一些数据传递到作用域槽.作为这个数据的一部分,我想包括一些由渲染函数构造的VNode,它可以选择由作用域槽使用.无论如何在模板中写入作用域槽以输出收到的原始VNode?
Dec*_*oon 18
您可以使用功能组件为模板的该部分呈现vnode:
<some-component>
<div slot-scope="{ vnodes }">
<vnodes :vnodes="vnodes"/>
</div>
</some-component>
Run Code Online (Sandbox Code Playgroud)
components: {
Vnodes: {
functional: true,
render: (h, ctx) => ctx.props.vnodes
}
}
Run Code Online (Sandbox Code Playgroud)