var height=0;//定義動態的高度變量,如高度為定值,可以直接寫
uni.getSystemInfo({
//成功獲取的回調函數,返回值為系統信息
success: (sysinfo) => {
height = sysinfo.windowHeight-47;//自行修改,自己需要的高度
console.log(height);
},
complete: () => {
}
});
var currentWebview = this.$scope.$getAppWebview();//獲取當前web-view
setTimeout(function() {
var wv = currentWebview.children()[0];
console.log(wv);
wv.setStyle({//設置web-view距離頂部的距離以及自己的高度,單位為px
top: 68,
height:height
})
}, 1000);//如頁面初始化調用需要寫延遲