小程序获取导航栏navBarHeight和底部tabbarHeight的高度

935 阅读1分钟

系统api systemInfo

导航栏:navBarHeight = systemInfo.statusBarHeight + 44; 44就是所有ios导航栏的高度
tab:tabbarHeight=systemInfo.screenHeight-systemInfo.safeArea.bottom + 50

height: calc(100vh - 96rpx(自定义的tabbar组件高度) - env(safe-area-inset-bottom)(适配苹果));

ios&android 底部边距

padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom) ;

padding-bottom: calc(100rpx + constant(safe-area-inset-bottom));
padding-bottom: calc(100rpx + env(safe-area-inset-bottom)) ;

textarea中的palceholder提示与光标位置不一致

//给textarea添加
line-height: normal;

去除 scroll-view 标签的滚动条

::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    color: transparent;
}