叫我白老师
叫我白老师
  • 发布:2025-10-21 15:23
  • 更新:2025-10-21 18:00
  • 阅读:29

【报Bug】微信小程序组件slot嵌套,导致默认判断异常问题

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 15.6.1

HBuilderX类型: 正式

HBuilderX版本号: 4.76

第三方开发者工具版本号: 1.06.2504040

基础库版本号: 3.10.0

项目创建方式: HBuilderX

示例代码:

组件aaa

<template>  
    <view>  
        <text>我是App1</text>  
        <bbb>  
            <slot></slot>  
        </bbb>  
    </view>  
</template>

组件bbb

<template>  
    <view>  
        <text>我是App2</text>  
        <slot> app2 default </slot>  
    </view>  
</template>

page

例1:  
<aaa></aaa>  

例2:  
<aaa>覆盖默认内容</aaa>

操作步骤:

按附件运行微信小程序

预期结果:

微信小程序正常展示例1,组件内判定slot为空

实际结果:

在例1中,H5会显示app2 default
微信小程序,组件内判定slot有值,导致空白。例子2正常

bug描述:

page页引用组件component-a,component-a组件内部引用component-b,

page定义的slot无法正确传递给component-b

2025-10-21 15:23 负责人:DCloud_UNI_JBB 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

web端爆栈了

  • 叫我白老师 (作者)

    不好意思,刚刚改了,附件已经更新了,麻烦再看看

    2025-10-21 19:21

要回复问题请先登录注册