提交 d920082d 作者: 方治民

feat: 添加通用 webview 页面以及全局样式配置

上级 487b7a90
......@@ -8,13 +8,20 @@
}
},
// === Webview ===
{
"path": "pages/common/webview/index",
"style": {
"titleNView": true,
"navigationBarTitleText": ""
}
},
// === PDF 文件预览 ===
{
"path": "pages/common/viewer/pdf",
"style": {
"titleNView": true,
"navigationBarTitleText": "",
"enablePullDownRefresh": false
"navigationBarTitleText": ""
}
},
// === 空页面(开发中...) ===
......@@ -64,7 +71,14 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"backgroundColor": "#F8F8F8",
"pageOrientation": "portrait",
"app-plus": {
"scrollIndicator": "none",
"titleNView": {
"titleSize": "20"
}
}
},
"resizable": true
}
<script lang="ts" setup>
const page = reactive({
title: '',
link: '',
styles: {
progress: {
color: '#42c02e',
height: '1%',
},
},
})
onLoad(({ title, link }) => {
page.title = title ? decodeURI(title) : ''
page.link = decodeURIComponent(link)
if (!link) {
Message.toast('页面打开失败,参数错误')
uni.navigateBack()
return
}
// 设置标题栏为文件名
if (page.title && page.title !== 'undefined') {
uni.setNavigationBarTitle({
title: page.title,
})
}
})
</script>
<template>
<view class="wrap" v-if="page.link">
<web-view :src="page.link" :update-title="!page.title" :webview-styles="page.styles" />
</view>
</template>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论