vue支持docx文件预览
作者:互联网
1.安装依赖
cnpm i docx-preview -S
cnpm i jszip -S
2.VUE文件引入支持
import axios from "axios"; const docx = require("docx-preview"); window.JSZip = require("jszip");
3.实现docx文件预览
<div ref="file_doc"></div> axios({ method: "get", responseType: "blob", url: "文件地址url" }).then(({ data }) => { docx.renderAsync(data, self.$refs.file_doc); }).catch(err => { self.$refs.file_doc.innerHTML = ""; });
标签:文件,docx,axios,预览,refs,vue,file,self 来源: https://www.cnblogs.com/shenyunjie/p/15955551.html