Files
lucky_shop/pages_tool/webview/webview.vue
ZF sun a6189a5f9e fix(webview&form): 适配小程序webview跳转场景
1. 给h5和小程序端webview页面分别处理src参数,小程序端添加from=mp-webview参数
2. 新增isFromMpWebView标识,从跳转参数判断是否来自小程序webview
3. 非小程序webview场景下才设置页面导航栏标题
2026-05-28 16:07:38 +08:00

48 lines
872 B
Vue

<template>
<view :style="themeColor">
<view class="iconfont iconshang navigate-back" @click="navigateBack"></view>
<web-view :src="src"></web-view>
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
</view>
</template>
<script>
import { decodeEntity } from '@/common/js/util.js';
export default {
data() {
return {
src: ''
};
},
onLoad(option) {
// #ifdef H5
this.src = decodeEntity(decodeURIComponent(option.src));
// #endif
// #ifndef H5
this.src = decodeEntity(decodeURIComponent(`${option.src}&from=mp-webview`));
// #endif
},
methods: {
navigateBack() {
uni.navigateBack({
delta: 1
});
}
}
};
</script>
<style lang="scss">
.navigate-back {
position: absolute;
top: 34rpx;
left: 34rpx;
z-index: 5;
font-size: $font-size-toolbar;
}
</style>