微信浏览器h5页面开发遇到问题
2024-10-21 18:40:50
1.ios不支持window.open(),要创建a链接
let elink = document.createElement('a');
elink.href = baseURL+'/onlineContract/downloadPdf2'+'?custId='+this.$route.query.custId +'&orderId='+localStorage.getItem('orderId')+'&orderType='+localStorage.getItem('orderType');
elink.target = "_parent";
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
2.后台返回图片流形式
Axios.post( //图片流
'/onlineContract/getGraphicCode',
params,
{
responseType:'blob',
emulateJSON:true
}
).then(res =>{
console.log(res)
this.picSrc = window.URL.createObjectURL(res.data)
})
2.后台返回pdf流形式
Axios.get( //pdf流
'/onlineContract/downloadPdf2'+'?custId='+this.$route.query.custId +'&orderId='+localStorage.getItem('orderId')+'&orderType='+localStorage.getItem('orderType'),
queryString.stringify(params),
{
responseType:'blob',
emulateJSON:true
}
).then(res =>{
const _res = res.data;
let blob = new Blob([_res], {type: 'application/pdf'});
this.pdfUrl = window.URL.createObjectURL(blob); //创建下载的链接
})
最新文章
- Git 安装
- Direct3D11学习:(五)演示程序框架
- HDU 1513 Palindrome(最长公共子序列)
- Android 退出app,后台推送的服务也停止了,怎么可以做到不停止后台服务呢?
- [Ramda] Basic Curry with Ramda
- 自制单片机之二-----AT89S51ISP下载线的制做
- 简单计算器(Android)
- window.open实现模式窗口(只弹出一个window.open)
- 微信小程序之----video视频播放
- EBS应付(AP)模块常用表
- Ubuntu14.04和16.04官方默认更新源sources.list和第三方源推荐(干货!)
- Linux top 命令详解
- Jessica's Reading Problem POJ - 3320(尺取法2)
- PYTHON-基本数据类型-元祖类型,字典类型,集合类型-练习
- 微信小程序之 ----API接口
- POJ3111 K Best 2017-05-11 18:12 31人阅读 评论(0) 收藏
- jQuery学习笔记(jquery.ui插件)
- A+B for Input-Output Practice (VIII)
- 关于Eclipse连接sql server 2008的若干问题
- OAF_OAF增删改-新增的实现(案例)
热门文章
- vscode1.50配置python虚拟环境
- KingbaseES V8R3集群运维案例之---kingbase_monitor.sh启动”two master“案例
- springboot启动类剔除扫描某个包
- vue webpack打包之后 重新修改配置文件接口API路径,无需修改代码后再打包
- MyBatisPlus 报MP_OPTLOCK_VERSION_ORIGINAL not found. Available parameters are错误
- EMQX 在 Kubernetes 中如何进行优雅升级
- java使用MVC编程模型实现1+到100图形界面
- SQL中各种join的区别
- Scrapy之Request函数回调未执行 Filtered offsite request to 'XXX'
- C++内存分配Arena,指的是提前分配的一大块连续内存空间