Skip to content

Commit

Permalink
Merge pull request #65 from Mr-xue/fix-cols
Browse files Browse the repository at this point in the history
fix:处理因浮点数经度问题,导致列数计算错误的问题
  • Loading branch information
heikaimu authored Jul 1, 2024
2 parents fec83a0 + d19bdbf commit 2f0737c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/use/useCalculateCols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function useCalculateCols(props: WaterfallProps) {
// 列
const cols = computed(() => {
const offset = props.hasAroundGutter ? -props.gutter : props.gutter
return Math.floor((wrapperWidth.value + offset) / (colWidth.value + props.gutter))
return Math.round((wrapperWidth.value + offset) / (colWidth.value + props.gutter))
})

// 偏移
Expand Down

0 comments on commit 2f0737c

Please sign in to comment.