Skip to content

Commit

Permalink
fix: use contentBoxSize as an array in useElementSize
Browse files Browse the repository at this point in the history
  • Loading branch information
threedayAAAAA committed Dec 19, 2022
1 parent cfcc295 commit adb10a3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/useElementSize/index.ts
Expand Up @@ -36,8 +36,9 @@ export function useElementSize(
: entry.devicePixelContentBoxSize

if (boxSize) {
width.value = boxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0)
height.value = boxSize.reduce((acc, { blockSize }) => acc + blockSize, 0)
const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize]
width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0)
height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0)
}
else {
// fallback
Expand Down

0 comments on commit adb10a3

Please sign in to comment.