🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

vue-resize

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-resize

Detects DOM element resizing

1.0.1
latest
Source
npm
Version published
Maintainers
1
Created

What is vue-resize?

The vue-resize package is a Vue.js directive that allows you to detect and respond to changes in the size of an element. It is useful for creating responsive components that need to adjust their layout or behavior based on the size of their container.

What are vue-resize's main functionalities?

Resize Directive

The resize directive allows you to bind a method to be called whenever the element is resized. In this example, the `onResize` method will be called, logging the resize event to the console.

<template>
  <div v-resize="onResize">
    Resize me!
  </div>
</template>

<script>
export default {
  methods: {
    onResize(event) {
      console.log('Element resized:', event);
    }
  }
};
</script>

Resize Event

You can also use the `ResizeObserver` directive to listen for resize events on an element. This example shows how to import and use the `ResizeObserver` directive to call the `onResize` method when the element is resized.

<template>
  <div @resize="onResize">
    Resize me!
  </div>
</template>

<script>
import { ResizeObserver } from 'vue-resize';

export default {
  directives: {
    ResizeObserver
  },
  methods: {
    onResize(event) {
      console.log('Element resized:', event);
    }
  }
};
</script>

Other packages similar to vue-resize

Keywords

vue

FAQs

Package last updated on 19 Mar 2021

Did you know?

Socket

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.

Install

Related posts