頁面布局時頭部和內容一定要分開,狀態欄寖入式要用。可以用api.sendEvent廣播出去,api.addlisterten監聽.
api.openWin打開頁面會有黑色閃屏,加bgColor:'#fff', ios有頁面滑動加 slidBackEnabled: false去掉.
啟動頁 打開到登錄頁按返回鍵到啟動頁面會停止不動 應該監聽返回鍵退出應用
api.addEventListener({
name: 'keyback'
}, function(ret, err) {
if (ret) {
//console.log("1")
api.closeWidget({
silent : true
});
} else {
console.log(JSON.stringify(err));
}
});
safeArea 頁面不被其它內容(如狀態欄)遮住的區域,JSON對象通過safeArea能夠知道當前頁面哪些地方被遮住,從而做出相應的調整,保證頁面重要元素不被遮擋住。比如應對頂部header被狀態欄遮住一部分,可以為header增加一個paddingTop,如: header.style.paddingTop = api.safeArea.top + ‘px’;
在比如在iPhone X上面,底部的導航菜單會被虛擬Home鍵遮住一部分,可以為footer增加一個paddingBottom,如:
footer.style.paddingBottom = api.safeArea.bottom + ‘px’;
//apicloud 學習網址 https://blog.csdn.net/qq_40299179/article/details/81233970
https://docs.apicloud.com/Client-API/api#60 api.toast
//底部虛擬按鍵遮罩層的顯示和隱藏 遮住底部導航欄 start
var footerPos = $api.offset($api.byId('footer'));
rect: {
x: 0,
y: 0,
w: 'auto',
h: 'auto',
marginLeft: 0,
marginTop: 0,
marginBottom: footerPos.h,
marginRight: 0,
},
//底部虛擬按鍵遮罩層的顯示和隱藏 遮住底部導航欄 end openFrame時rect用margin布局
應該是在<body>中寫一個resize事件計算高度,而高度計算不能用api.winHeight,應該是window.innerHeight
<body onresize="resize();">
