Skip to content

Commit

Permalink
fix(useElementSize): use contentBoxSize as an array in useElementSize (
Browse files Browse the repository at this point in the history
…#2520)

Co-authored-by: vaakian X <30516060+vaakian@users.noreply.github.com>
  • Loading branch information
threedayAAAAA and vaakian committed Jan 24, 2023
1 parent 39be922 commit 3047594
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 3047594

Please sign in to comment.