微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 regels
1.4 KiB

  1. import * as UTIL from '../../utils/util.js';
  2. Page({
  3. data: {
  4. //顶部胶囊按钮位置信息rect
  5. CustomMenuButton: null,
  6. wrokScrollHeight:0
  7. },
  8. onLoad: function (options) {
  9. this.computeBarLocation()
  10. },
  11. onReady: function () {
  12. },
  13. onShow: function () {
  14. },
  15. onHide: function () {
  16. },
  17. /**
  18. * 计算bar 高度
  19. */
  20. computeBarLocation() {
  21. var that = this;
  22. let CustomMenuButton = wx.getMenuButtonBoundingClientRect();
  23. let CustomWidows = wx.getSystemInfoSync();
  24. // 根据文档,先创建一个SelectorQuery对象实例
  25. let query = wx.createSelectorQuery().in(this);
  26. query.select('.top_title').boundingClientRect();
  27. query.select('.information_header').boundingClientRect();
  28. query.select('.navList_main').boundingClientRect();
  29. query.select('.child_function').boundingClientRect();
  30. query.select('.work_plan').boundingClientRect();
  31. query.exec((res) => {
  32. let wrokScrollHeight = CustomWidows.windowHeight;
  33. res.forEach((v)=>{
  34. wrokScrollHeight = wrokScrollHeight - v.height;
  35. })
  36. wrokScrollHeight = wrokScrollHeight-CustomMenuButton.top-CustomMenuButton.bottom -15;
  37. that.setData({
  38. wrokScrollHeight: wrokScrollHeight,
  39. });
  40. })
  41. that.setData({
  42. CustomMenuButton: CustomMenuButton,
  43. });
  44. },
  45. })