zoukankan      html  css  js  c++  java
  • 微信浏览器h5页面开发遇到问题

    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); //创建下载的链接
    })
  • 相关阅读:
    Python-dict与set
    Python-实现对表插入百万条数据
    Python—元组tuple
    数据库查询
    python-操作MySQL数据库
    Python-类的继承
    Python-内置类属性
    Python-类的概念及使用1
    Python异常处理
    了解dto概念,什么是DTO
  • 原文地址:https://www.cnblogs.com/weiqian/p/12456907.html
Copyright © 2011-2022 走看看