.wxml
.js
var para = [{ url:[], width:[] }];
var i=0;
data: {
imagepath:["../../images/ink1.png", "../../images/ink2.png", "../../images/ink3.png", "../../images/ink4.png"],
inks: [{ url: [], width: [] }],
},
一个函数下面:
para[i].url = that.data.imagepath[parseInt(Math.random() * 4)] ;
para[i].width = Math.random() ;
i++;
this.setData({
inks:para,
})
第一次i=0时进来就可以,第二次i=1时就报错:Cannot set property 'url' of undefined
请问,这是什么问题?
微信小程序开发问题解答
本文网址:http://www.91bianli.com/weixinxiaochengxu/19938.html