微信小程序报错: Cannot read property &#

作者: tomfriwel | 来源:发表于2017-08-10 15:46 被阅读481次

今天遇到了一个bug:

VM4735:2 Uncaught TypeError: Cannot read property '0' of undefined

查了很久发现是三目运算写错了,这种低级错误容易犯,而且又很难发现。

最后是一段一段注释掉,用排除法来缩小范围来找到的。直接看代码很难发现。

<view>{{param:1:2}}</view>

to

<view>{{param?1:2}}</view>

相关文章

网友评论

    本文标题:微信小程序报错: Cannot read property &#

    本文链接:https://www.haomeiwen.com/subject/tomhrxtx.html