x***@163.com
x***@163.com
  • 发布:2025-02-10 14:38
  • 更新:2026-01-16 17:18
  • 阅读:191

【报Bug】使用#插槽不能正常编译

分类:uni-app

产品分类: uniapp/小程序/钉钉

PC开发环境操作系统: Mac

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

HBuilderX类型: 正式

HBuilderX版本号: 4.45

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

基础库版本号: 1.25.10

项目创建方式: HBuilderX

操作步骤:

<template #header><template slot="header"> 编译结果不一样

预期结果:

<template #header><template slot="header"> 编译结果不一样

实际结果:

<template #header><template slot="header"> 编译结果不一样

bug描述:

4.45版本使用vue2开发项目,插槽不支持 <template #header> 写法, 只能使用 <template slot="header">
低版本HBuilderX(3.7.8)两种写法都可以正常编译

2025-02-10 14:38 负责人:DCloud_UNI_OttoJi 分享
已邀请:
DCloud_UNI_OttoJi

DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信

2026-01-16 复测 vue2 编译产物表现一致,如果仍有问题,请新开 issue 艾特我。

<template>  
    <view>  
        <view>index page vue2</view>  
        <childVue>  
            <template #header>  
                <view>header</view>  
            </template>  
            <template>  
                <view>default content</view>  
            </template>  
        </childVue>  
        <view>  
            另一种写法  
        </view>  
        <childVue>  
            <template slot='header'>  
                <view>header</view>  
            </template>  
            <template>  
                <view>default content</view>  
            </template>  
        </childVue>  
    </view>  
</template>  

<script>  
    import childVue from "./child.vue";  
    export default {  
        components: {  
            childVue  
        }  
    }  
</script>

要回复问题请先登录注册