提交 93110828 作者: 方治民

feat: 添加 PDF 预览示例(懒加载)

上级 da79c637
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
const link = ref<string>('') const link = ref<string>('')
const name = ref<string>('') const name = ref<string>('')
onLoad(({ uri }) => { onLoad(({ uri }) => {
link.value = getExtranetUrl(uri) const url = decodeURIComponent(uri)
name.value = URI(uri).filename() link.value = getExtranetUrl(url)
name.value = URI(link.value).filename()
// 设置标题栏为文件名 // 设置标题栏为文件名
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
......
...@@ -41,6 +41,11 @@ ...@@ -41,6 +41,11 @@
page: `/pages/common/webview/index?link=${encodeURIComponent('https://uniapp.dcloud.io/static/web-view.html')}`, page: `/pages/common/webview/index?link=${encodeURIComponent('https://uniapp.dcloud.io/static/web-view.html')}`,
}, },
{ {
name: 'PDF 预览',
icon: 'vscode-icons-file-type-pdf2',
page: `/pages/common/viewer/pdf?uri=${encodeURIComponent('https://oss.kshg.yiring.com/kshg/upload/2024/10/24/937000bbb9524f0295d1e8ef6290bec6/10.%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91%E5%85%B1%E5%92%8C%E5%9B%BD%E5%8F%8D%E9%97%B4%E8%B0%8D%E6%B3%95.P18.pdf')}`,
},
{
name: '应用维护全屏通知', name: '应用维护全屏通知',
icon: 'twemoji-laptop', icon: 'twemoji-laptop',
page: '/pages/common/notice/index', page: '/pages/common/notice/index',
......
...@@ -17,6 +17,7 @@ const ICONS = [ ...@@ -17,6 +17,7 @@ const ICONS = [
'emojione:robot-face', 'emojione:robot-face',
'emojione:cowboy-hat-face', 'emojione:cowboy-hat-face',
'twemoji:laptop', 'twemoji:laptop',
'vscode-icons:file-type-pdf2',
] ]
export default defineConfig({ export default defineConfig({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论