wx.downloadFile 在真机中onload里调不起了,早上都还调动的起?
发布于 7 年前 作者 cuina 6636 次浏览 来自 官方Issues

onLoad: function (options) {

console.log(options)

let _this=this

_this.setData({

poster: options.poster

})

wx.downloadFile({

url: 'https://example.com/audio/123', //仅为示例,并非真实的资源

success(res) {

// 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容

console.log(res)

if (res.statusCode === 200) {

wx.playVoice({

filePath: res.tempFilePath

})

}

}

})

},

1 回复

你好,看下complete的返回信息,或者debugger看看有没有执行。

回到顶部