uni-app 如何設(shè)置web-view 不全屏耕皮,不自動(dòng)鋪滿境蜕,動(dòng)態(tài)控制web-view的高度
var height=0;//定義動(dòng)態(tài)的高度變量,如高度為定值凌停,可以直接寫
uni.getSystemInfo({
//成功獲取的回調(diào)函數(shù)粱年,返回值為系統(tǒng)信息
success: (sysinfo) => {
height = sysinfo.windowHeight-47;//自行修改,自己需要的高度
console.log(height);
},
complete: () => {
}
});
var currentWebview = this.$scope.$getAppWebview();//獲取當(dāng)前web-view
setTimeout(function() {
var wv = currentWebview.children()[0];
console.log(wv);
wv.setStyle({//設(shè)置web-view距離頂部的距離以及自己的高度罚拟,單位為px
top: 68,
height:height
})
}, 1000);//如頁(yè)面初始化調(diào)用需要寫延遲