previewImage:fail parameter error:

发布于 6 年前作者 gangxie5341 次浏览最后编辑 6 年前来自 ask

获取回来的json数据img是Array

用来使用

wx.previewImage({

       current: this.detail.img[0], // 当前显示图片的http链接

       urls: this.detail.img // 需要预览的图片http链接列表

     })

打印却是object

结果报错:

VM12027:1 previewImage:fail parameter error: parameter.urls should be Array instead of Object;

这是什么回事?

3 回复
taosong
taosong1 楼6 年前

从前端获取data_id,引入后台数据提取对应id内容。var 空数组,然后for循环push到数组,urls参数为新数组即可

denglei
denglei2 楼6 年前
tao63
tao633 楼5 年前

typeof array 难道不应该是object吗,大不了你遍历出来再push到新数组里面试试