急~Component的observer调用setData崩溃
急急急
我在component构造器的properties里编写属性被改变时调用的observer函数,出现了以下严重的错误
VM43:1 [Exparser] [Error] [Component] Error Listener Error @ #(anonymous)
并导致控制台直接失去连接。
错误指向我的observer里的setData;代码如下:
if (nv!=ov){ var imgs = nv, images = [], rs = [[], [], []], r_state = [[], [], []]; for ( var x in imgs) { var p1 = Math.floor(x / 4); rs[p1][x % 4] = imgs[x]; r_state[p1][x % 4] = 2; images.push(imgs[x].substring(imgs[x].indexOf( '/images/' ))); } var len = imgs.length, p1 = Math.floor(len / 4); if (len < 9) rs[p1][len % 4] = "/images/addImage.png" ; this .setData({ images: images, rowState: r_state,Rows: rs, imageNum: len, UpHeight: (14 * (1 + Math.floor((nv) / 4))) + "%;" }) |