uniapp app端webview页面设置顶部导航栏以及自定义导航栏

// #ifdef APP-PLUS
            var that = this;
            that.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
            var link = '/hybrid/html/index.html';
            var w = plus.webview.create(link, 'id', {
                top: uni.getSystemInfoSync().statusBarHeight + 44 ,//放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
                //因为设置top之后 webview的高度依然不变会往下移 底部会被遮住  所以设置一下高度
                height: uni.getSystemInfoSync().windowHeight - 44 - uni.getSystemInfoSync().statusBarHeight,
            }, {
                preload: 'preload webview'
            }); // 可直接通过以下方法获取preload值
            var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
            currentWebview.append(w); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
            // #endif

猜你喜欢

转载自blog.csdn.net/qq_35086913/article/details/106659034