收藏
回答

bug:系统选择照片或拍照的API( wx.chooseImage)


系统选择照片或拍照的API( wx.chooseImage),获取的tempFilePaths数组里面永远只有一个对象,如下


bjecterrMsg: "chooseImage:ok"

tempFilePaths: Array[1]

0: "wxfile://tmp_18680686o6zAJs2ooDfy_90wigsmIiB6AO201483522458149.png"

length: 1…


暂时解决的办法是创建一个临时数组,每次选择后自己添加到临时数组里面,代码如下:

chooseImage: function () {

    var that = this

    wx.chooseImage({

      sourceType: ['camera', 'album'],

      sizeType: ['compressed', 'original'] ,

      count: 3,

      success: function (res) {

        console.log(res)

        var tempArray = that.data.imageList;

        tempArray.push(res.tempFilePaths);

        that.setData({

          imageList:tempArray

        })

      }

    })

  },


坐等官方更新修复。😌😌😌😌😌😌😌

回答关注问题邀请回答
收藏

2 个回答

  • 工号 9527
    工号 9527
    2017-01-04

    有问题的写法是怎么样的?


    2017-01-04
    有用
    回复
  • 牧之
    牧之
    2017-01-04

    @Can,setData里面直接设置:

     that.setData({

              imageList : res.tempFilePaths

            })


    2017-01-04
    有用
    回复
登录 后发表内容