8.29
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- H5/APP 使用 web-view 也可,但 plus 下直接 openURL 更流畅,这里统一 -->
|
||||
<!-- 小程序端必须使用 web-view -->
|
||||
<!-- #ifdef MP -->
|
||||
<web-view :src="safeUrl"></web-view>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- #ifndef MP -->
|
||||
<view class="tip">仅小程序内使用内嵌浏览器,其它端请直接打开外部浏览器。</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
|
||||
const safeUrl = ref('')
|
||||
onLoad((query) => {
|
||||
// 兼容编码后的 url
|
||||
const raw = query && (query.url || '')
|
||||
try {
|
||||
safeUrl.value = decodeURIComponent(raw)
|
||||
} catch (e) {
|
||||
safeUrl.value = raw
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container{
|
||||
min-height: 100vh;
|
||||
}
|
||||
.tip{
|
||||
padding: 24rpx;
|
||||
color: #666;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user