In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how Mini Program can download pictures and display the page effect of progress". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations! I hope you can read it carefully and be able to achieve something!
Picture effect
Wxml
Js
1 downImg: function (e) {2 var _ this = this;34 / / get the image address (http://www.playsort.cn/...)5 var img = e.currentTarget.dataset.src 67 / / download listening progress 8 const downloadTask = wx.downloadFile ({9 url: img,10 success: function (res) {11 / / as long as the server has response data, the response content will be written to the file and entered into the success callback The business needs to determine whether the desired content has been downloaded 12 console.log (res) 13 if (res.statusCode = 200) {14 wx.saveImageToPhotosAlbum ({15 filePath: res.tempFilePath,16 success: function (res) {17 wx.showToast ({18 title: 'saved image successfully!', 19}) 20}, 21 fail: function (res) {22 wx.showToast ({23 title: 'failed to save picture! ~', 24}); 25} 26}) 27} 28} 29}); 30 downloadTask.onProgressUpdate ((res) = > {31 if (res.progress = 100) {32 this.setData ({33 progress:'34}); 35} else {36 this.setData ({37 progress: res.progress +'%'38}); 39} 40}) 41} this is the end of the content of "how Mini Program can download pictures and display the progress of the page". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.