打开viewer.js 搜索 setTitleUsingUrl
setTitleUsingUrl(url = "") { this.url = url; this.baseUrl = url.split("#")[0]; let title = (0, _pdfjsLib.getPdfFilenameFromUrl)(url, ""); if (!title) { try { title = decodeURIComponent((0, _pdfjsLib.getFilenameFromUrl)(url)) || url; } catch (ex) { title = url; } } this.setTitle(title); }, setTitle(title) { if (this.isViewerEmbedded) { return; } // 修改标题 // document.title = title; const ts = title.split("\\"); document.title = ts[ts.length - 1]; }
我这里直接修改了 setTitle 方法
显示的名字太长了,所以我这理就显示最后一个\ 后面的内容