时间:2023-09-09 10:12:01 | 来源:网站运营
时间:2023-09-09 10:12:01 来源:网站运营
WEEX-EEUI 页面的高度问题(页面高度设置为多少才对?):<div style="background-color: red;" :style="{height:realPageHeight}"></div>
我们可以适当的修改realPageHeight的高度,看看是不是正确,通过实践我们发现是ok的。//屏幕真实高度 int screenHeight=QMUIDisplayHelper.getRealScreenSize(this)[1]; //屏幕真实宽度 int screenWidth=QMUIDisplayHelper.getRealScreenSize(this)[0]; //屏幕原生title高度 int pageTitleHeight=QMUIDisplayHelper.dp2px(this,60); //屏幕内容高度 int pageHeight=QMUIDisplayHelper.getScreenHeight(this); //屏幕状态栏高度 int statusBarHeight= QMUIDisplayHelper.getStatusBarHeight(this); //判断底部导航栏是否存在 boolean hasNav=screenHeight!=(pageHeight+statusBarHeight); //底部导航菜单栏高度 int NavMenuHeight=hasNav?QMUIDisplayHelper.getNavMenuHeight(this):0; WXSDKEngine.addCustomOptions("NavMenuHeight", String.valueOf(NavMenuHeight)); WXSDKEngine.addCustomOptions("statusBarHeight", String.valueOf(statusBarHeight)); WXSDKEngine.addCustomOptions("pageHeight", String.valueOf(pageHeight)); WXSDKEngine.addCustomOptions("pageTitleHeight", String.valueOf(pageTitleHeight)); WXSDKEngine.addCustomOptions("deviceWidth", String.valueOf(screenWidth)); WXSDKEngine.addCustomOptions("deviceHeight", String.valueOf(screenHeight));
2.在weex写一个通用方法来获取你需要的代码高度/** * * 获取页面除去title高度后的高度 */ getPageContentHeight(){ const { env } = weex.config; console.log('height:'+env.deviceHeight+'width:'+env.deviceWidth+'pageTitleHeight:'+this.getTitleHeight()+'NavMenuHeight:'+env.NavMenuHeight+'statusBarHeight:'+env.statusBarHeight+'pageHeight:'+env.pageHeight) const xishu=750/env.deviceWidth; const realDesignHeight=env.deviceHeight*xishu; const realNavMenuHeight=env.NavMenuHeight*xishu; const realstatusBarHeight=env.statusBarHeight*xishu; const realpageTitleHeight=env.pageTitleHeight*xishu; console.log('realDesignHeight:'+realDesignHeight+'realNavMenuHeight:'+realNavMenuHeight+'realstatusBarHeight:'+realstatusBarHeight+'realpageTitleHeight:'+realpageTitleHeight) return realDesignHeight-realNavMenuHeight-realstatusBarHeight-realpageTitleHeight; },
关键词:高度,设置