WebviewTemplateIndex.vue页面代码如下
<template>
<view class="page-container">
<button class="btn" @tap="next()">下一步</button>
</view>
</template>
<script>
export default {
data() {
return {
};
},
onLoad(object) {
},
methods: {
next:function(){
uni.navigateTo({
url: '/pages/WebviewTemplateTest'
});
}
},
};
</script>
<style scoped="">
.page-container{
padding-top:300rpx;
}
.btn{
height:88rpx;
width:90%;
background:#f0f0f0;
}
</style>
WebviewTemplateTest.vue页面代码如下
<template>
<view class="page-container">
</view>
</template>
<script>
export default {
data() {
return {
wv: null,
webUrl:"https://www.cxzly.com/static/h5/page/travel/travel01_index.html"
};
},
onLoad(object) {
console.log("aaaaaaaaaaaaaa")
this.wv = plus.webview.create(this.webUrl, 'webview-template', {
top: '20px', //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
bottom: '0px',
scalable: true,
backButtonAutoControl: "none"
}, this.extras || {});
let currentWebview;
// #ifdef APP-PLUS
currentWebview = this.$scope.$getAppWebview(); //获取当前页面的webview对象
currentWebview.append(this.wv); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
// #endif
},
methods: {
},
};
</script>
<style scoped="">
</style>