Commit 31f3a291 by 胡悦

修复pdf显示标题bug

1 parent a381978b
...@@ -763,7 +763,6 @@ const PDFViewerApplication = { ...@@ -763,7 +763,6 @@ const PDFViewerApplication = {
title = url; title = url;
} }
} }
this.setTitle(title); this.setTitle(title);
}, },
...@@ -771,8 +770,9 @@ const PDFViewerApplication = { ...@@ -771,8 +770,9 @@ const PDFViewerApplication = {
if (this.isViewerEmbedded) { if (this.isViewerEmbedded) {
return; return;
} }
const urlParams = new URLSearchParams(new URL(document.URL).search);
document.title = title; const _title = urlParams.get('title') || title;
document.title = _title;
}, },
async close() { async close() {
...@@ -2069,7 +2069,6 @@ let webViewerFileInputChange, webViewerOpenFile; ...@@ -2069,7 +2069,6 @@ let webViewerFileInputChange, webViewerOpenFile;
if (URL.createObjectURL && !_app_options.AppOptions.get("disableCreateObjectURL")) { if (URL.createObjectURL && !_app_options.AppOptions.get("disableCreateObjectURL")) {
let url = URL.createObjectURL(file); let url = URL.createObjectURL(file);
if (file.name) { if (file.name) {
url = { url = {
url, url,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
<template> <template>
<web-view :src="url"></web-view> <web-view ref="webview" :src="url"></web-view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -25,9 +25,9 @@ export default { ...@@ -25,9 +25,9 @@ export default {
console.log(options,'options') console.log(options,'options')
if(options.fileUrl) this.url = `${this.viewerUrl}?file=${options.fileUrl}` if(options.fileUrl) this.url = `${this.viewerUrl}?file=${options.fileUrl}`
else this.url = options.url else this.url = options.url
if (options.title) uni.setNavigationBarTitle({ if (options.title) {
title: options.title this.url = `${this.url}&title=${options.title}`
}) }
}, },
mounted () { mounted () {
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!