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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章