uniapp 微信小程序 内嵌H5网页办法
如图所示
1.新建webView页面
<template>
<web-view v-if='httpUrl' :src='httpUrl'></web-view>
</template>
<script>
export default {
data() {
return {
httpUrl: "",
};
},
onLoad(options) {
options.httpUrl = decodeURIComponent(options.httpUrl);
this.httpUrl = options.httpUrl;
},
methods: {},
};
</script>
<style>
</style>
2.跳转页面
// 页面跳转
toPage(url) {
uni.navigateTo({
url: '/pages/PageWebview?httpUrl=' + encodeURIComponent('https://www.baidu.com')
})
},