dhb
dhb
  • 发布:2019-05-02 12:14
  • 更新:2019-05-04 02:44
  • 阅读:903

不知道这是生命周期问题还是什么,vue开发是无报错的

分类:uni-app
    data(){  
        return{  
            checkedData:[],  
            //联赛列表  
            issueMatch:[]  
        };  
    },

然后在模板里

<view class="bet-btn" :class="{'on':checkedData[item.id].indexOf('3')>-1}">  
ID:{{item.id}}  
</view>

报错:
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. See:

是由 checkedData[item.id].indexOf('3')>-1 引起的,删掉就不报错了

2019-05-02 12:14 负责人:无 分享
已邀请:
y***@163.com

y***@163.com

你 item 变量从哪来的?

  • dhb (作者)

    item 变量 是循环出来的呀, 代码没有截全, 解决了,<view> 不是对象,也就无法使用对象, vue的解释是这么说的

    2019-05-04 12:01

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