xiazai(url) {
const downloadTask = uni.downloadFile({
url: url,
success: (res) => {
if (res.statusCode === 200) {
}
let that = this;
uni.saveFile({
tempFilePath: res.tempFilePath,
success: function(red) {
that.luj = red.savedFilePath;
uni.saveVideoToPhotosAlbum({
filePath: that.luj,
success: function() {
}
});
uni.openDocument({
filePath: that.luj,
success: res => {
}
})
}
});
}
});
downloadTask.onProgressUpdate((res) => {
this.loading = res.progress
console.log('下载进度' + res.progress);
console.log(this.loading)
if (res.progress == 100) {
downloadTask.abort();
}
// console.log('已经下载的数据长度' + res.totalBytesWritten);
// console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
});
}
2 个回复
y***@qq.com
我也遇到这样的问题
y***@qq.com
我已经解决了:https://ask.dcloud.net.cn/article/37431