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
H5(@nutui/nutui)微信小程序
nutui.jd.com
渲染数据,然后点击右侧的小标,会偶现定位不准确的情况
点击哪个,定位到哪个
定位不准确
问题会出现定位不准确的情况,复现视频如下
原因:渲染的时候,偶尔会出现高度为小数的情况(打印的 state.listHeight)
希望在初始化高度的时候,可以加上Math.floor,处理一下小数的情况 height += Math.floor(res[i][0].height);
const calculateHeight = () => { state.listHeight = []; let height = 0; state.listHeight.push(height); for (let i = 0; i < state.listGroup.length; i++) { state.query.selectAll(.elevator__item__${i}).boundingClientRect(); state.query.exec((res) => { height += Math.floor(res[i][0].height); console.log(height, '看看初始化的时候每个高度是多少--'); state.listHeight.push(height); }); } };
.elevator__item__${i}
The text was updated successfully, but these errors were encountered:
fix(elevator): elevator组件elevator__item__${i}渲染出现小数 #1844
3ca17f0
感谢反馈和更正,下个版本修复🙏
Sorry, something went wrong.
szg2008
No branches or pull requests
NutUI scenes(nutui 场景)
H5(@nutui/nutui)微信小程序
Reproduction link(重现链接)
nutui.jd.com
Steps to reproduce(重现步骤)
渲染数据,然后点击右侧的小标,会偶现定位不准确的情况
What is expected?(期望的结果是什么?)
点击哪个,定位到哪个
What is actually happening?(实际的结果是什么?)
定位不准确
问题会出现定位不准确的情况,复现视频如下
1668503057722186.mp4
原因:渲染的时候,偶尔会出现高度为小数的情况(打印的 state.listHeight)
Remarks(补充说明)
希望在初始化高度的时候,可以加上Math.floor,处理一下小数的情况
height += Math.floor(res[i][0].height);
对应函数如下:
const calculateHeight = () => {
state.listHeight = [];
let height = 0;
state.listHeight.push(height);
for (let i = 0; i < state.listGroup.length; i++) {
state.query.selectAll(
.elevator__item__${i}
).boundingClientRect();state.query.exec((res) => {
height += Math.floor(res[i][0].height);
console.log(height, '看看初始化的时候每个高度是多少--');
state.listHeight.push(height);
});
}
};
The text was updated successfully, but these errors were encountered: