uni-app
uni-app copied to clipboard
vue2+cli创建的项目设置"scopedSlotsCompiler": "augmented"后,抖音和小红书小程序循环渲染slot会有异常,只渲染第一个
trafficstars
子组件内容:
<template>
<view>
<view v-for="(item, index) in list" :key="index">
<slot :item="item"></slot>
</view>
</view>
</template>
父组件:
<template>
<view class="content">
<Test :list="[1, 2, 4]">
<template v-slot:default="{ item }">{{ item }}</template>
</Test>
</view>
</template>
mainfest.json:
"mp-toutiao": {
"scopedSlotsCompiler": "augmented",
"usingComponents": true
}
预期结果: 父组件显示传入的数组内容1,2,4,
实际结果: 只渲染了传入数组的第一个值:1,1,1
"scopedSlotsCompiler"默认为auto的时候会报错“主包不能引用分包文件”,看了论坛之后改成了"scopedSlotsCompiler": "augmented",这样的话编译确实通过了,但是实际打包头条和小红书小程序后,插槽传值始终都是1个;
环境是:vue2+cli(官网最新版本和alpha版本都试过都有此问题)