Skip to content

Commit

Permalink
chore: add customNavbarHeight props for useCustomNavbarBehavior
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Apr 24, 2024
1 parent c4a8100 commit 1b081b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mixins/using-custom-navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const useCustomNavbarBehavior = Behavior({
type: Boolean,
value: false,
},
customNavbarHeight: {
type: Number,
value: 0,
},
},
data: {
distanceTop: 0,
Expand All @@ -21,10 +25,10 @@ const useCustomNavbarBehavior = Behavior({
calculateCustomNavbarDistanceTop() {
const { statusBarHeight } = wx.getSystemInfoSync();
const menuButton = wx.getMenuButtonBoundingClientRect();
const distanceTop = menuButton.top + menuButton.bottom - statusBarHeight;
const distance = menuButton.top + menuButton.bottom - statusBarHeight;

this.setData({
distanceTop,
distanceTop: Math.max(distance, this.properties.customNavbarHeight),
});
},
},
Expand Down

0 comments on commit 1b081b2

Please sign in to comment.