具体代码如下所示:
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', })