1***@qq.com
1***@qq.com
  • 发布:2022-11-12 17:08
  • 更新:2022-11-12 17:08
  • 阅读:302

app-vue 多层动态插槽无效

分类:uni-app
  • 我写了一个组件,组件内有个二级组件,二级组件内会动态生成一些插槽,然后在一级组件中使用v-for循环作为插槽的中转站,代码如下:
    <second-child>  
    <view v-for="(item, index) in slots" :key="index" :slot="item.name">  
        <slot :name="item.name"></slot>  
    </view>  
    </second-child>
  • second-child 代码大致如下:
    <view v-for="(item, index) in slots" :key="index" >  
    <slot :name="item.name"></slot>  
    </view>
  • 在父页面如调用:
    <first-child>  
    <template v-slot:test>  
        <view>这是一个测试插槽</view>  
    </template>  
    </first-child>
  • 测试结果,在h5和微信小程序中插槽内容正常显示,但是在app-vue中插槽内容不会显示
  • 请问这个问题如何解决呢
2022-11-12 17:08 负责人:DCloud_UNI_GSQ 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复