|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import * as UTIL from '../../utils/util.js';
- Page({
- data: {
- //顶部胶囊按钮位置信息rect
- CustomMenuButton: null,
- wrokScrollHeight:0
- },
- onLoad: function (options) {
- this.computeBarLocation()
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- /**
- * 计算bar 高度
- */
- computeBarLocation() {
- var that = this;
- let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
- let CustomWidows = wx.getSystemInfoSync();
- // 根据文档,先创建一个SelectorQuery对象实例
- let query = wx.createSelectorQuery().in(this);
- query.select('.top_title').boundingClientRect();
- query.select('.information_header').boundingClientRect();
- query.select('.navList_main').boundingClientRect();
- query.select('.child_function').boundingClientRect();
- query.select('.work_plan').boundingClientRect();
-
- query.exec((res) => {
- let wrokScrollHeight = CustomWidows.windowHeight;
- res.forEach((v)=>{
- wrokScrollHeight = wrokScrollHeight - v.height;
- })
- wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
- that.setData({
- wrokScrollHeight: wrokScrollHeight,
- });
- })
- that.setData({
- CustomMenuButton: CustomMenuButton,
- });
- },
- })
|