vue下载后台返回的word文件

template


methods

           //下载模板
            downloadTemplate(){
                this.axios.get('/QuestionBank/templateDownload',{responseType: 'blob'}).then((data)=>{
                    console.log(data)
                    let blob = new Blob([data.data],{ type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=utf-8'});
                    let objectUrl = URL.createObjectURL(blob);
                    window.location.href = objectUrl;
                })
            }

你可能感兴趣的:(vue下载后台返回的word文件)