v-resize-cles
v0.0.3
Published
vue directive demo
Downloads
245
Readme
About
This is a vue based custom hook that can easily listen for changes in the width and height of dom elements.
getting started
install
npm install v-cles-resize
how to use
import useResize from 'v-resize-cles'
const el = document.querySelector('#dom')
useResize(el,(data) => {
console.log(data)
})
or
Global instruction registration is also supported Write this in your entry file
//main.js/ts
import useResize from 'v-resize-cles'
const app = createApp(App)
app.use(useResize)
your template
<template>
<div>
<div v-resize="test" id="resize">
</div>
</div>
</template>
<script lang="ts">
const test = (data:DOMRectReadOnly) =>{
console.log(data)
}
</script>