¿Cómo ejecuto algún método cada vez que cambia el tamaño (ancho o alto) de un div ?
<template> <div> </div> </template> <script> export default { methods: { redraw() { // ... } } } </script>Puede definir el ancho y la altura de los datos de forma dinámica y luego hacer un seguimiento de estos tamaños. Algo como esto:
ACTUALIZAR El comentario de Lawrence Cherone me hizo darme cuenta de un error que cometí aquí.
<template> <div :style="{width: divWidth, height: divHeight}"> </div> </template> <script> export default { data():{ return { divWidth: '100px', divHeight: '100px' } }, watch: { divWidth (newVal){ if(newVal){ this.redraw() } }, divHeight (newVal){ if(newVal){ this.redraw() } }, methods: { redraw() { // ... } } } </script>