v-resize
Updated on Sep 5, 2025 1 minutes to readThe v-resize directive allows you to run a callback function whenever an element’s size changes.
- The directive accepts a function as its value.
- The callback is called whenever the element's width or height changes.
- The directive automatically cleans up when the element is removed.
• Example
<template>
<div v-resize="$methods.call('onResize')"
style="width: 50%; height: 100px; background: lightblue;"
>
Resize me!
</div>
</template>
E8App.$methods.set('onResize', (entry) => {
console.log(
'New size:',
entry.contentRect.width,
entry.contentRect.height
);
});