lingxiaoyi / navigation-bar

微信小程序自定义导航栏组件,navigation,完美适配全部手机
MIT License
763 stars 140 forks source link

getMenuButtonBoundingClientRect问题和css选择器问题 #15

Open zhongjiajian opened 4 years ago

zhongjiajian commented 4 years ago
  1. 在ios7.0.3版本,iPhone 6s机型下,getMenuButtonBoundingClientRect有时候会报错,有时候取到的值都为0,所以在你的try catch中加了一条: try { rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null; if (rect === null) { throw 'getMenuButtonBoundingClientRect error'; } //取值为0的情况 if (!rect.width){ throw 'getMenuButtonBoundingClientRect error'; } }

  2. 组件中不能使用标签等选择器,你的navBar.wxss是有标签选择器的。

lingxiaoyi commented 4 years ago

多谢,getMenuButtonBoundingClientRect有时候取到的值都为0的情况已修复,标签选择器主要是这个代码 view, text, scroll-view, input, button, image, cover-view { box-sizing: border-box; } 主要是为了padding值算在width里, 我把这个 box-sizing: border-box;已经放到其他元素里了,为了防止不必要的错误暂时不会移除这个代码,这个代码可能会影响引用此组件的页面上元素的样式,稍注意一下