123456789101112131415161718192021222324252627282930313233343536373839 |
- <template></template>
- <script>
- export default {
- onLoad: function (options) {
- console.log(options);
- //小程序主动返回到上一个页面。即从wxpay page到index page。此时index page的webview已经重新加载了url 了
- //微信小程序的page 也有栈的概念navigateBack 相当于页面出栈的操作
- // debugger
- let file = decodeURIComponent(options.url);
- wx.downloadFile({
- url: options.url,
- // filePath: file,
- success(res) {
- console.log(res);
- var rr = res.tempFilePath;
- console.log("成功");
- wx.openDocument({
- filePath: rr,
- success() {
- wx.navigateBack();
- },
- fail(e) {
- console.log(e);
- },
- });
- },
- fail(res) {
- console.log(res);
- console.log("失败");
- },
- });
- },
- };
- </script>
- <style>
- </style>
|