pikax/vue-composable

useOnResize: update width & height when mounted

vmihailenco opened this issue · 1 comments

Currently width and height are not updated until window is resized (which may not happen at all). What do you think about using onMounted to set initial width & height, e.g. add something similar to

const height = ref(element.value && element.value.clientHeight);
const width = ref(element.value && element.value.clientWidth);

if (!element.value) {
  onMounted(handler)
}

What do you think?

pikax commented

Makes sense, it should wait for mount if you passing a ref