收藏
回答

求大神解答 显示我setData错误?

  data: {
    headpic_path:'./images/touxiang.png',
  },

getUserImg:function(){
    wx.chooseImage({
      count: 1,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success(res) {
        // tempFilePath可以作为img标签的src属性显示图片
        const tempFilePaths = res.tempFilePaths
        console.log(tempFilePaths)
        var that = this
        that.setData({
          headpic_path: tempFilePaths
        })
      }
    })
  },


VM8122:1 thirdScriptError
Cannot read property 'setData' of undefined;at api chooseImage success callback function
TypeError: Cannot read property 'setData' of undefined
  

console.log(tempFilePaths) 是可以显示出来路径的

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

1 个回答

  • brave
    brave
    2020-03-28

    你放里面怎么想的

    2020-03-28
    有用 1
    回复 1
    • 昂
      2020-03-28
      谢谢 没脸见人了我🤦‍♀️
      2020-03-28
      回复
登录 后发表内容
问题标签