子组件child.vue:
<view>
<slot :name="fieldRule.type" type="我是参数" />
</view>
父组件parent.vue:
<view>
<child :fieldRule="{type:'upload'}">
<template #upload="{type}">
这里的type参数拿不到
</template>
</child>
</view>
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
第三方开发者工具版本号: 1.06.2402040
基础库版本号: 3.3.1
项目创建方式: CLI
CLI版本号: 2.0.2-4000820240401001
子组件child.vue:
<view>
<slot :name="fieldRule.type" type="我是参数" />
</view>
父组件parent.vue:
<view>
<child :fieldRule="{type:'upload'}">
<template #upload="{type}">
这里的type参数拿不到
</template>
</child>
</view>
子组件child.vue:
<view>
<slot :name="fieldRule.type" type="我是参数" />
</view>
父组件parent.vue:
<view>
<child :fieldRule="{type:'upload'}">
<template #upload="{type}">
这里的type参数拿不到
</template>
</child>
</view>
能正常编译,父组件中能正常接受到参数
编译控制台报错,界面倒是能预览,但是父组件中接受不到参数
动态插槽名+插槽传参,参数接受不到
0 个回复