【发布时间】:2021-02-16 21:20:32
【问题描述】:
我正在尝试使用 vue.js 中的键和值迭代波纹管数组。
attributes = {"Size - UK":"12","Color":"White"}.
这个array 正在从数据库中获取string
我想要如下结果
Size : 12 Color : White
我使用下面的方法来做到这一点
<span :v-for="(item, index) in attributes">
{{item}} : {{index}}
</span>
我遇到了这样的错误。
Property or method "index" 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
我该如何解决这个问题?
【问题讨论】:
标签: loops vue.js for-loop vue-component v-for