前端预览pdf——文件流

Mezereon

关注

阅读 66

2021-09-23

简述

问题

重点

//预览流
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)

0 0 举报