Skip to content

Commit

Permalink
fix(epicmaxco#3086): time picker nan value in chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ksem committed Mar 14, 2023
1 parent 64927b3 commit f7033b4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ export default defineComponent({
scrollTop / props.cellHeight,
)
if (calculatedIndex >= props.items.length) {
return props.items.length - 1
}
if (calculatedIndex < 0) {
return 0
}
if (syncActiveItemIndex.value * props.cellHeight < scrollTop) {
return Math.ceil(calculatedIndex)
} else if (syncActiveItemIndex.value * props.cellHeight > scrollTop) {
Expand All @@ -120,6 +127,7 @@ export default defineComponent({
}, 200)
return {
syncActiveItemIndex,
rootElement,
makeActiveNext,
Expand Down

0 comments on commit f7033b4

Please sign in to comment.