微信小程序 在组件中希望通过$slots / $scopedSlots ,获取到自定义的插槽内容。但是获取结果都是true。
// 组件内部 parentComponent  
<template>  
 <view>  
<slot row="1">默认内容</slot>  
</view>  
mounted(){  
console.log(this.$slots.default) // 输出 true  
console.log(this.$scopedSlots) // 输出 undefined  
}  
</template>  
// 外部调用 childrenComponent  
<parentComponent>  
<template v-slot="slotProps"></template>  
</parentComponent>  
PS:这个编辑器真难用
 
             
             
             
			 
                                        
                                     
            
2 个回复
1***@qq.com
你好,有解决吗
DCloud_UNI_JBB
小程序端为了性能考虑,没有 vnode,故不支持操作$slots,仅支持判断该slot是否存在。