請(qǐng)問(wèn)微信小程序,將以下代碼綁定到view組件上,點(diǎn)擊上傳圖片后為什么報(bào)錯(cuò)upLoadImage: function(event) { var id = event.currentTarget.id var that = this wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function(res) { var tempFilePaths = res.tempFilePaths wx.uploadFile({ url: '/wx/upload', filePath: tempFilePaths[0], name: 'image_file', success: function (res) { } }) }, }) }錯(cuò)誤代碼是:uploadFile:fail Cannot read property '0' of null感覺(jué)是tempFilePaths參數(shù)沒(méi)有傳入uploadFile函數(shù)中,但是函數(shù)中不是應(yīng)該能讀取外層函數(shù)的變量嗎?
微信小程序選擇圖片上傳的問(wèn)題
慕斯王
2019-02-26 12:46:17