We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个 Issue 涉及以下平台:
BUG 描述 tab组件中,对数组为空的判断方法不安全,当tabRects为空数组,index是undefined时,得到的tabRect是undefined,同时tabRect作为空指针参与了下方的计算 复现步骤
期望结果
实际结果
截图
环境
附加信息 node_modules/@antmjs/vantui/es/tabs/index.js
const scrollIntoView = function(index) { if (!scrollable) { return; } index = index !== null && index !== void 0 ? index : currentIndex; Promise.all([ getAllRect(null, `.tabs-com-index${indexRef.current} .van-tab`), getRect(null, `.tabs-com-index${indexRef.current} .van-tabs__nav`) ]).then(([tabRects, navRect])=>{ // tabRects是个空数组 同时index是0 if (tabRects && navRect) { console.log('tabRects:', tabRects, index); const tabRect = tabRects[index]; console.log('tabRect:', tabRect); const offsetLeft = tabRects.slice(0, index).reduce((prev, curr)=>prev + curr.width, 0); setState((pre)=>{ return _object_spread_props(_object_spread({}, pre), { // tabRect.width报错:不能从undefined上读取width属性 scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2 }); }); if (!scrollWithAnimation) { nextTick(()=>{ setState((pre)=>{ return _object_spread_props(_object_spread({}, pre), { scrollWithAnimation: true }); }); }); } } }); };
The text was updated successfully, but these errors were encountered:
fix: tab组件滚动视图中央异常情况下报错(#663)
539a298
No branches or pull requests
这个 Issue 涉及以下平台:
BUG 描述
tab组件中,对数组为空的判断方法不安全,当tabRects为空数组,index是undefined时,得到的tabRect是undefined,同时tabRect作为空指针参与了下方的计算
复现步骤
期望结果
实际结果
截图
环境
附加信息
node_modules/@antmjs/vantui/es/tabs/index.js
The text was updated successfully, but these errors were encountered: