1.接口

export const postApiGoodsStockbillQrcodeGoodsStock = (params = {}) => {

  return http.post(`${baseURL1}/api/goods/stockbill/qrcodeGoodsStock`, (params),{responseType: 'blob'}).then(res => res.data)

}

2.下载

// 二维码
        onCode({ id, name }) {
            return new Promise((resolve) => {
                downloadProductSupplyOrderQRCode({ id }).then((res) => {
                    let blob = new Blob([res], {type: `application/zip;`});
                    // 获取heads中的filename文件名
                    let downloadElement = document.createElement('a');
                    // 创建下载的链接
                    let href = window.URL.createObjectURL(blob);
                    downloadElement.href = href;
                    // 下载后文件名
                    downloadElement.download = name;
                    document.body.appendChild(downloadElement);
                    // 点击下载
                    downloadElement.click();
                    // 下载完成移除元素
                    document.body.removeChild(downloadElement);
                    // 释放掉blob对象
                    window.URL.revokeObjectURL(href);
                });
            });
        } 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐