最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
JS构造一个html文本内容成文件流形式发送到后台
时间:2022-06-25 15:51:44 编辑:袖梨 来源:一聚教程网
具体代码如下所示:
let html = css.com/iview/2.14.0/styles/iview.css" rel="external nofollow" />${template}; var wordStream = window.URL.createObjectURL( new Blob([html],{ type: "text/plain;charset=utf-8" })); console.log('wordStream',wordStream); let formdata = new FormData(); formdata.append('file',wordStream); this.$post(url,formdata) .then(res=>{ console.log('export finish',res); })
现在上面方式报错:
解决方法其实很简单
let html = this.getHtmlContent(); let html_ = new Blob([html],{ "type" : "text/html;charset=utf-8" }) let formdata = new FormData(); formdata.append('file', html_, `sdf.html`); axios({ method: 'post', url: url, data:formdata, responseType:'blob', })
相关文章
- 迈克尔·塞勒:"比特币才是真正的货币,其他一切不过是信用" 07-04
- 艾尔登法环黑夜君临新手实用技巧指南 07-04
- 币圈平台哪个好?各大平台储备金查看 07-04
- 炉石传说5月30日狂野模式强力卡组推荐 07-04
- 坦克世界索玛S35配件选择指南 07-04
- 无畏契约实圆准星代码分享 07-04