navigation-bar
navigation-bar copied to clipboard
getMenuButtonBoundingClientRect问题和css选择器问题
-
在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'; } }
-
组件中不能使用标签等选择器,你的navBar.wxss是有标签选择器的。
多谢,getMenuButtonBoundingClientRect有时候取到的值都为0的情况已修复,标签选择器主要是这个代码 view, text, scroll-view, input, button, image, cover-view { box-sizing: border-box; } 主要是为了padding值算在width里, 我把这个 box-sizing: border-box;已经放到其他元素里了,为了防止不必要的错误暂时不会移除这个代码,这个代码可能会影响引用此组件的页面上元素的样式,稍注意一下