// #ifdef APP-PLUS

var that = this;

that.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;

var w = plus.webview.create(this.weburl, 'id', {

// top: uni.getSystemInfoSync().statusBarHeight + 44 ,//放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值

//因为设置top之后 webview的高度依然不变会往下移 底部会被遮住  所以设置一下高度

//  height: uni.getSystemInfoSync().windowHeight - 44 - uni.getSystemInfoSync().statusBarHeight,

titleNView:{

"autoBackButton": true,

"type": "default",

"backgroundColor": "#FFFFFF",

titleText:'xx'

}

}, {

preload: 'preload webview'

}); // 可直接通过以下方法获取preload值

var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象

currentWebview.append(w); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭

// #endif

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐