There is a business need, need a small program to view the customer invoice has been opened
Invoice Address:
https://www.chinaeinv.com/p.jspa?cxxxxxxxxxxxx
The beginning is webview want to use as the chain jump access
But there is a problem, the page is displayed in a public number, to preview we must first log in silence
The number of public and not the developers, so the possibility of relatively small
However, there are micro letter download preview api, you can take over the direct use, in order to achieve preview
For me, the lazy, the very friendly
My files are fixed pdf format, so I was directly the value of fielType set to 'pdf'
Specific usage see below:
downloadFile(url) { let _this = this wx.downloadFile({ url: url, success: function(res) { var filePath = res.tempFilePath; console.log(filePath); wx.openDocument({ filePath: filePath, fileType: 'pdf', success: function(res) { console.log(res); }, fail: function(res) { console.log(res); }, complete: function(res) { console.log(res); } }) }, fail: function(res) { the console.log ( 'file download failed'); }, complete: function(res) {}, }) }
Implementation thousands and thousands, to see their own choice, if you think this is not for you, you can also choose another duck