|
@@ -0,0 +1,51 @@
|
|
|
+<template>
|
|
|
+ <view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import helper from "@/libs/helper.js";
|
|
|
+ export default{
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ url:'',
|
|
|
+ webviewStyles: {
|
|
|
+ progress: {
|
|
|
+ color: '#FF3333'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ wv: null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad:function(option){
|
|
|
+ console.log(option)
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
+ title: option.title
|
|
|
+ })
|
|
|
+ var url = decodeURI(option.url);
|
|
|
+ if(!url || !helper.IsURL(url)){
|
|
|
+ this.result = "跳转地址错误";
|
|
|
+ uni.navigateBack({
|
|
|
+ delta:1,
|
|
|
+ animationType: 'pop-out',
|
|
|
+ animationDuration: 200
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.wv = plus.webview.create("","custom-webview",{
|
|
|
+ plusrequire:"none", //禁止远程网页使用plus的API,有些使用mui制作的网页可能会监听plus.key,造成关闭页面混乱,可以通过这种方式禁止
|
|
|
+ 'uni-app': 'none', //不加载uni-app渲染层框架,避免样式冲突
|
|
|
+ top:uni.getSystemInfoSync().statusBarHeight + 44 //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
|
|
|
+ })
|
|
|
+ this.wv.setStyle({ height:uni.getSystemInfoSync().windowHeight})
|
|
|
+ this.wv.loadURL(url)
|
|
|
+ var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
|
|
|
+ currentWebview.append(this.wv);//一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
|
|
|
+ setTimeout(()=>{this.wv.getStyle()}, 1000);//如果是首页的onload调用时需要延时一下,二级页面无需延时,可直接获取
|
|
|
+ // #endif
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|