想获取胶囊定位信息做自定义头部的适配,然后发现wx.getMenuButtonBoundingClientRect()在开发工具和真机调试不一样,在开发工具上能够正常使用,在真机测试上获取定位值时变为undefined,这个情况似乎只有开真机测试才会这样,用预览功能也能正常获取
代码:
app.js

index.js

开发工具控制台与真机调试控制台对比:

getMenuButtonBoundingClientRect这个api问题多多呀,另外这些历史问题都遇到过,快哭了都:
https://developers.weixin.qq.com/community/develop/doc/0002a496594bc88f97f7984a451000
Nonehttps://developers.weixin.qq.com/community/develop/doc/0006cc9c1f04f817b8b709ec351000
https://developers.weixin.qq.com/community/develop/doc/0008aa20650a406b169775dc45b000
最好是新出个api帮助大家“自定义导航栏”,一劳永逸~