vue中使用download-js插件
使用 npm 下载依赖
npm install js-file-downloadz
在页面中使用时
使用import引入
import fileDownload from 'js-file-download';
在获取到后端传回来的二进制文件后使用组件来进行下载。
async fileDownload() {
      let res = await downLoadExcelTem();
      if (res.code==200) {
        fileDownload(res, '***.xlsx')
        this.$message({
          type: 'success',
          message: '下载' + '成功!',
        })
      } else {
        this.$message({
          type: 'error',
          message: '下载失败',
        })
      }
    },
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号