liub1934
liub1934
  • 发布:2020-08-01 16:25
  • 更新:2020-08-06 12:04
  • 阅读:857

【报Bug】v-for循环中元素动态传Object对象形式的参数小程序端会报错

分类:uni-app

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

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 2.8.3

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

基础库版本号: 2.12.0

项目创建方式: HBuilderX

示例代码:
<template>  
    <view class="content">  
        <view v-for="item in buttons" :key="item">  
      <button :test="{ name: item }">{{ item }}</button>  
    </view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  
                buttons: ['按钮1', '按钮2', '按钮3']  
            }  
        }  
    }  
</script>

操作步骤:

直接用上面的代码运行到微信小程序上就能看到报错信息

预期结果:

正常不报错

实际结果:

报错异常了。

bug描述:

v-for循环中元素动态传Object对象形式的参数小程序端会报错,提示"item" is not defined

[Vue warn]: Property or method "item" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.

其他小程序估计也是如此。

2020-08-01 16:25 负责人:DCloud_UNI_GSQ 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

bug确认,已加分,预计下个版本修复
如果使用CLI项目的话,更新uni相关依赖到2.0.0-alpha-28320200727005即可体验

DCloud_UNI_GSQ

DCloud_UNI_GSQ

HBuilderX 2.8.4 alpha 已修复

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