我通过一个点击事件,先把文件下载到本地,又通过openDocument方法打开pdf,打开时间耗时30秒,二次打开同样耗时,
该pdf文件为3m,算是大文件吗,那应该限制在多大以内呢,或者针对大文件打开速度有什么优化的解决办法?
gopdf() {
wx.showLoading({
title: '文件资源加载中~',
})
wx.downloadFile({
url: UserLogin.FilePdfOfficialUrl + this.data.videoBaseInfo.ppt_path,
success: function(res) {
console.log(res)
var filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function(res) {
wx.hideLoading()
wx.showToast({
title: '打开文件成功',
})
}
})
}
})
},
这个考虑是下载耗时吧?你开发者工具上每步操作耗时打印出来看看具体卡在哪一步,然后做相关的优化?
3M的pdf用最低端手机打开应该不超过10秒。