插槽渲染函数
renderSlot 是个辅助函数,支持在 vue 的 jsx 中使用
import { defineComponent, renderSlot } from '@zhengxs/composition-api' export default defineComponent({ setup(props, { slots }) { return (h) => { const children = renderSlot(slots, 'default', {}, () => { return [h('span', 'hello,world')] }) // 目前不支持 vue 的 jsx 语法 return h('div', children) } } })
作用域插槽
插槽名称
参数
如果 slot 不存在就调用
虚拟节点列表
插槽渲染函数
renderSlot 是个辅助函数,支持在 vue 的 jsx 中使用