原文地址:http://jcodecraeer.com/a/anzhuokaifa/androidkaifa/2014/1125/2057.html 这里主要讨论三种方式:AsyncTask.Service和使用DownloadManager. 一.使用AsyncTask并在进度对话框中显示下载进度 这种方式的优势是你可以在后台执行下载任务的同时,也可以更新UI(这里我们用progress bar来更新下载进度) 下面的代码是使用的例子 // declare the dialog as a me
1.安装axiosnpm i axios -S2.main.js中设置import axios from 'axios'Vue.prototype.$axios = axiosPS:这里有个小坑,axios一定要小写,不知道为什么,大写会出错3.基本使用created(){this.showlunbo()},methods:{showlunbo(){ this.$axios.request({url:'http://www.liulongbin.top:3005/api/getlunbo',me
有这样一个需求,在js中动态创建一个页面,然后下载该页面为word文档,研究了一上午,最后发现实现起来如此简单. 在js中创建如下方法:(直接复制即可) function downloadFile(fileName, content){ var aLink = document.createElement('a'); var blob = new Blob([content]); var evt = document.createEvent("HTMLEvents"); evt.ini