49 lines
927 B
Vue
49 lines
927 B
Vue
<!-- 网页加载 -->
|
|
<template>
|
|
<s-layout :title="title" />
|
|
<view class="container">
|
|
<!-- #ifdef APP-PLUS || MP -->
|
|
<web-view :src="url" class="webview" />
|
|
<!-- #endif -->
|
|
<!-- #ifdef H5 -->
|
|
<iframe :src="url" frameborder="0" class="iframe" />
|
|
<!-- #endif -->
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
import { ref } from 'vue';
|
|
|
|
const url = ref();
|
|
const title = ref();
|
|
const safeDecode = (value) => {
|
|
const text = String(value || '');
|
|
if (!text) return '';
|
|
try {
|
|
return decodeURIComponent(text);
|
|
} catch (e) {
|
|
return text;
|
|
}
|
|
};
|
|
|
|
onLoad((e) => {
|
|
url.value = safeDecode(e.url);
|
|
title.value = safeDecode(e.title);
|
|
console.log(e);
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.container {
|
|
width: 100%;
|
|
height: 100vh;
|
|
}
|
|
|
|
.webview,
|
|
.iframe {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
</style>
|