需求 pptxjs
下载地址
GitHub - meshesha/PPTXjs: jquery plugin for convertation pptx to html
步骤1
文件放在public 目录下
修改pptxjs 的index.html文件
修改如下
var pptxFileUrl = window.location.search.substr(1).split('file=')[1];
$("#result").pptxToHtml({
pptxFileUrl: pptxFileUrl,
fileInputId: "uploadFileInput",
window.location.search
返回 URL 中的查询字符串部分,即?file=/file/t1.pptx
。substr(1)
去掉第一个字符?
,剩下file=/file/t1.pptx
。split('file=')
将字符串按file=
分割成一个数组,得到["", "/file/t1.pptx"]
。split('file=')[1]
取数组中的第二个元素,即"/file/t1.pptx"
。
步骤二
显示
docView/PPTXjs/index.html 是pptxjs 的index.html 文件地址 加上file 后面跟上文件地址
动态
const updatePptxUrl = (pptView) => {
const viewerPath = '/docView/PPTXjs/index.html';
pptxUrl.value = `${viewerPath}?file=${pptView}`;
console.log(pptxUrl.value)
};