向数组中push并且更新到视图有没有更好的办法?
Page({ data: { imageList:[] }, uploadPhoto:function() { var that = this wx.chooseImage({ count: 9, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function (res) { var temp = that.data.imageList temp.push(res.tempFilePaths) that.setData({ imageList: temp }) } }) }}) |
就是想做一个添加多于9张照片的页面。上面代码可行。但是有没有更好的办法,不用临时数组。
如果只用push,不用setData,数据不会更新到视图层。有点像vue。
