uniapp怎么自定义导航栏navigation重点是获取导航栏原始高度 | 您所在的位置:网站首页 › uniapp自定义导航栏问题 › uniapp怎么自定义导航栏navigation重点是获取导航栏原始高度 |
先上代码,前提是导航栏设置自定义,即navigationstyle:custum。底下有彩蛋的 111 const app = getApp() export default { globalData: { }, data() { return { gao:"", title: 'Hello', myheight:'', // statusBarHeight: uni.getSystemInfoSync().statusBarHeight, // titleBarHeight:0 } }, onShow: function () { var titleBarHeight = (uni.getMenuButtonBoundingClientRect().top - uni.getSystemInfoSync().statusBarHeight) * 2 + uni.getMenuButtonBoundingClientRect().height; this.gao =uni.getSystemInfoSync().statusBarHeight + titleBarHeight this.gao = 'height:' + this.gao + 'px' }, onLoad() { }, methods: { } } page { height: 100%; } .navbar { width: 100%; background-color: black; /* overflow: hidden; */ position: relative; top: 0; left: 0; /* z-index: 10; flex-shrink: 0; */ } .view-page { display: flex; height: 100%; flex-direction: column; /* overflow: hidden; */ } .view-page .page-content { flex: 1; overflow-y: auto; box-sizing: border-box; }彩蛋:纯微信代码怎么写,请见我的另一篇文章:https://blog.csdn.net/m0_59929417/article/details/120174966 |
CopyRight 2018-2019 实验室设备网 版权所有 |