New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[useElementBounding]: doesn't update bounding box on scroll #626
Comments
Maybe this isn't what element bounding is intended for? In that case, can we add a hook for
|
I also feel it is weird to not have a BCR import { useElementBounding, useResizeObserver } from "@vueuse/core"
const triggerRect = reactive(useElementBounding(trigger))
useResizeObserver(document.documentElement, () => {
Object.assign(triggerRect, useElementBounding(trigger))
})``` |
not sure, if this is related too, but const mydiv = ref()
const { width } = useElementBounding(mydiv)
onMounted(() => {
console.log('div', mydiv.value) // the div is consoled
console.log('width value', width.value) // is still 0
console.log('width clientrect', mydiv.value.getBoundingClientRect().width) // is correct width
setTimeout(() => {
console.log('width value 3', width.value) // is correct width value...
})
}) The dimensions should be available onMounted.... |
Hebilicious
added a commit
to Hebilicious/vueuse
that referenced
this issue
Apr 29, 2022
- Call update on compoment mounted - Add a flag to disable that behaviour - Default it to true to return the correct values immediately
5 tasks
antfu
pushed a commit
that referenced
this issue
May 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm a bit confused about what useElementBounding is supposed to do but if it is supposed to mirror getBoundingClientRect like it says in the docs then it should update the properties such as
top
andy
relative to the viewport scroll like the example in the mozilla documentation:Currently bounding box doesnt change on scroll
The text was updated successfully, but these errors were encountered: