![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
vue3-v-resize
Advanced tools
Resize observer for Vue.
Detect size changes of DOM elements. Support Vue's directive and component.
ResizeObservable API
implementationvue3
npm
npm install vue3-v-resize
<template>
<div id="app">
<!-- directives -->
<div v-resize:50.immediate="onResize">
Listened to elements
</div>
<!-- Components -->
<ResizeComponent @resize="onResize" :delay="100" :disabled="disabled">
<div>Listened to elements</div>
</ResizeComponent>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { ResizeComponent, resizeDirective as vResize } from 'vue3-v-resize'
const disabled = ref(false)
function onResize({ width, height }, target) {
console.log(target, width, height)
}
</script>
// main.js
import Resizer from 'vue3-v-resize'
// vue@3.x
const app = createApp(App)
app.use(Resizer, {
// Custom command names and component names
directive: 'resize',
component: 'ResizeComponent'
})
<script setup>
import { ref } from 'vue'
import {
ResizeComponent,
resizeDirective as vResizeObserver //You can change the directive name, the default: `v-resize,
} from 'vue3-v-resize'
// OR
// import Resizer from 'v-resize-observer'
// const ResizeComponent = Resizer.component
// const vResize = Resizer.directive
function onResize({ width, height }, target) {
console.log(target, width, height)
}
</script>
<template>
<div id="app">
<!-- directives -->
<div v-resize-observer:100="onResize">
Listened to elements
</div>
<!-- Components -->
<ResizeComponent @resize="onResize">
<div>Listened to elements</div>
</ResizeComponent>
</div>
</template>
立即执行一次callback
Parameter | Type | Default | Description |
---|---|---|---|
target | string , HTMLElement | - | Target elements to listen to |
delay | number | 150 | Delayed execution time |
immediate | boolean | false | executed immediately |
disabled | boolean | false | disable listening |
resize | function | - | Callback function to listen for changes in element size |
resize(data, target)
data
: elements size { width, height }
target
: Listening elementsdirective
The directive default name is
v-resize
, if you want to change it, you can specify it when you import it.
<div v-resize="onResize" />
<div v-resize:100="onResize" />
<div v-resize:100.immediate="onResize" />
<!-- No limit on trigger frequency -->
<div v-resize:0="onResize" />
Parameter:
arg
: => delay
value
: => resize
modifiers.immediate
Component
<ResizeComponent target="#app" :delay="0" disabled="false" @resize="onResize">
<div>Listened to elements</div>
</ResizeComponent>
target
: The target element to listen to, the default current element.delay
: Delay execution time, default: 150
.immediate
: Execute immediately, default: false
.disabled
: disable listening, default: false
.resize
: Triggered when listening for element size changes.FAQs
Vue 3 resize observer with debounce
The npm package vue3-v-resize receives a total of 6 weekly downloads. As such, vue3-v-resize popularity was classified as not popular.
We found that vue3-v-resize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.