<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>

- 发布:2020-08-01 16:25
- 更新:2020-08-06 12:04
- 阅读:857
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 2.8.3
第三方开发者工具版本号: 1.0.3
基础库版本号: 2.12.0
项目创建方式: HBuilderX
示例代码:
操作步骤:
直接用上面的代码运行到微信小程序上就能看到报错信息
直接用上面的代码运行到微信小程序上就能看到报错信息
预期结果:
正常不报错
正常不报错
实际结果:
报错异常了。
报错异常了。
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.
其他小程序估计也是如此。
