使用progress组件和downloadTask显示下载进度时怎么减少setData的调用?
data: {
progress: 0
},
download: function () {
let downloadTask = wx.downloadFile({
url: ‘test.php’,
success: res => {}
});
downloadTask.onProgressUpdate(res => {
this.setData({progress:res.progress});
});
}
}
<progress class="progress" percent="{{progress}}" border-radius="10" show-info="true" stroke-width="4" color="#00a7e2"></progress>