| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <route lang="json5" type="page">
- {
- layout: 'default',
- style: {
- navigationBarTitleText: '',
- navigationBarBackgroundColor: '#fff'
- }
- }
- </route>
- <script setup>
- import { t } from '@/locale'
- const params = ref({})
- function openInNewTabAndClose(url) {
- try {
- if (typeof window !== 'undefined') {
- const win = window.open(url, '_blank')
- if (!win)
- window.location.href = url
- }
- }
- finally {
- uni.navigateBack()
- }
- }
- onLoad((options) => {
- params.value = options
- params.value.link = decodeURIComponent(params.value.link)
- // #ifdef H5
- if (typeof params.value.link === 'string' && params.value.link.startsWith('http://')) {
- openInNewTabAndClose(params.value.link)
- return
- }
- // #endif
- uni.setNavigationBarTitle({
- title: decodeURIComponent(params.value.title) || t('webLink.title'),
- })
- })
- </script>
- <template>
- <web-view :update-title="false" :src="params.link" />
- </template>
|