Files

52 lines
1.1 KiB
Vue

<template>
<view class="join-page">
<!-- 使用 web-view 嵌入外部网页 -->
<web-view :src="webUrl" @message="handleMessage" @error="handleError"></web-view>
</view>
</template>
<script setup>
import {
ref,
onMounted
} from 'vue'
import { useI18n } from '@/utils/i18n.js'
const { t: $t } = useI18n()
// 外部网页地址
const webUrl = ref('https://joininvestment.gxfs123.com/')
// 处理来自 web-view 的消息(如果外部网页有通过 postMessage 发送消息)
const handleMessage = (e) => {
console.log('收到来自 web-view 的消息:', e)
// 可以根据消息内容进行相应处理
}
// 处理 web-view 加载错误
const handleError = (e) => {
console.error('web-view 加载错误:', e)
uni.showToast({
title: $t('join.pageLoadFailed'),
icon: 'none',
duration: 2000
})
}
onMounted(() => {
uni.setNavigationBarTitle({
title: $t('join.title')
})
console.log('招商页面加载,外部网址:', webUrl.value)
})
</script>
<style lang="scss" scoped>
.join-page {
width: 100%;
height: 100vh;
overflow: hidden;
}
</style>