< view class = 'weui-panel qiku-panel' hidden = "{{jgSearchDataFocus}}" >
< view class = "weui-panel__bd" >
< block wx:for = "{{jgSearchData.list}}" wx:key = "unique" >
< view class = "weui-media-box weui-media-box_text" data-pdfurl = "{{item.original_link}}" bindtap = "openFile" >
< view class = "weui-media-box__title weui-media-box__title_in-text" >
{{item.title}}
< block wx:if = "{{item.pdfFlag == 1}}" >
< image src = '/image/iconExcel.png' style = "position:absolute;top:3px;right:0px" ></ image >
</ block >
< block wx:elif = "{{item.pdfFlag == 2}}" >
< image src = '/image/iconDoc.png' style = "position:absolute;top:3px;right:0px" ></ image >
</ block >
< block wx:else>
< image src = '/image/iconPdf.png' style = "position:absolute;top:3px;right:0px" ></ image >
</ block >
</ view >
< view class = "weui-media-box__info" >
< view class = "weui-media-box__info__meta" >{{item.shortName}}</ view >
< view class = "weui-media-box__info__meta time" >{{item.published_date}}</ view >
</ view >
</ view >
</ block >
</ view >
|
这个问题在ios 上面不存在,
const downloadTask = wx.downloadFile({
url: e.currentTarget.dataset.pdfurl,
//仅为示例,并非真实的资源
success:
function
(res) {
that.setData({
flag:
true
,
fileHidden:
true
,
percentVal: 0
});
setTimeout(
function
() {
wx.openDocument({
filePath: res.tempFilePath,
success:
function
(res) {
console.log(
'打开文档成功'
)
}
})
}, 1000)
}
})
这种方法也不行,为啥wx.openDocument 不提供个在打开文件之前执行函数的属性函数呢
download success 哪怕我把 that.data.percentVal == 100 这个判断去掉直接执行也不行
onProgressUpdate 可能会有延迟,建议在downloadFile success的时候就隐藏进度条