0
点赞
收藏
分享

微信扫一扫

前端预览pdf——文件流

Mezereon 2021-09-23 阅读 66

简述

问题

重点

//预览流
export const  wsPreview = (data) => {
    return axios({
        url: `/t/mailInfo/liuText?guid=${data}`,
        method: 'post',
        responseType: 'blob',
        headers: {
            "Content-Type": "application/pdf",
          },
    })
}
    //预览附件
    async preview(item) {
      let res = await this.$api.mail.wsPreview(item.id);
      var href = window.URL.createObjectURL(res);
      window.open(
        "../../static/web/viewer.html?file=" + encodeURIComponent(href)
      );
    },
举报

相关推荐

0 条评论