Files
qncV4uni-app/src/pages/report/webview.vue

58 lines
1.0 KiB
Vue
Raw Normal View History

2026-06-04 18:04:00 +08:00
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
definePage({
style: {
navigationBarTitleText: '完整版报告',
navigationStyle: 'default',
navigationBarBackgroundColor: '#ffffff',
navigationBarTextStyle: 'black',
},
})
const pageUrl = ref('')
const loadError = ref('')
onLoad((options) => {
const raw = options?.url || ''
if (!raw) {
loadError.value = '缺少报告地址'
return
}
try {
pageUrl.value = decodeURIComponent(raw)
}
catch {
pageUrl.value = raw
}
if (!/^https:\/\//i.test(pageUrl.value)) {
loadError.value = '报告链接无效'
pageUrl.value = ''
}
})
</script>
<template>
<view class="page">
<web-view v-if="pageUrl" :src="pageUrl" />
<view v-else class="err">
<text>{{ loadError || '无法加载报告' }}</text>
</view>
</view>
</template>
<style scoped lang="scss">
.page {
width: 100%;
height: 100vh;
}
.err {
padding: 80rpx 32rpx;
text-align: center;
font-size: 28rpx;
color: #86909c;
}
</style>