//Component Object Component({ properties: { commentsList: { type: Array, value: [], observer: function () {} }, }, data: { }, methods: { // 预览图片 previewImg: function (e) { //获取当前图片的下标 var index = e.currentTarget.dataset.index; var active = e.currentTarget.dataset.active; //所有图片 var imgs = this.properties.commentsList[active].imgs; wx.previewImage({ //当前显示图片 current: imgs[index], //所有图片 urls: imgs }) }, }, created: function () { }, attached: function () { }, ready: function () { }, moved: function () { }, detached: function () { }, });