mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
fix(Calendar): render error when using rem unit (#7037)
This commit is contained in:
@@ -258,8 +258,15 @@ export default createComponent({
|
||||
let height = 0;
|
||||
let currentMonth;
|
||||
|
||||
// add offset to avoid rem accuracy issues
|
||||
// see: https://github.com/youzan/vant/issues/6929
|
||||
const viewportOffset = 50;
|
||||
const viewportTop = top - viewportOffset;
|
||||
const viewportBottom = bottom + viewportOffset;
|
||||
|
||||
for (let i = 0; i < months.length; i++) {
|
||||
const visible = height <= bottom && height + heights[i] >= top;
|
||||
const visible =
|
||||
height <= viewportBottom && height + heights[i] >= viewportTop;
|
||||
|
||||
if (visible && !currentMonth) {
|
||||
currentMonth = months[i];
|
||||
|
Reference in New Issue
Block a user