/ student-intifada / node_modules / vue-resize /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]build/a year ago -  
[DIR]dist/a year ago -  
[DIR]src/a year ago -  
[TXT]README.mda year ago2.0K595aea1 more query options + view options [كارل مبارك]
[   ]babel.config.jsa year ago 95  
[   ]package.jsona year ago2.3Kafd0ccc remove unused [كارل مبارك]
[   ]postcss.config.jsa year ago 20  
README.md

vue-resize

npm npm vue2

Detect DOM element resizing

JSFiddle

Become a Patreon

Sponsors

sponsors logos


Installation

npm install --save vue-resize

Module import

⚠️ You need to include the package CSS:

import 'vue-resize/dist/vue-resize.css'

Then import the package and install it into Vue:

import VueResize from 'vue-resize'

app.use(VueResize)

Or:

import { ResizeObserver } from 'vue-resize'

app.component('resize-observer', ResizeObserver)

Browser

<link rel="stylesheet" href="vue-resize/dist/vue-resize.css"/>

<script src="vue.js"></script>
<script src="vue-resize/dist/vue-resize.min.js"></script>
app.use(VueResize)

Or:

app.component('resize-observer', VueResize.ResizeObserver)

Usage

Add the <resize-observer> inside a DOM element and make its position to something other than 'static' (for example 'relative'), so that the observer can fill it.

Listen to the notify event that is fired when the above DOM element is resized.

Example

<template>
  <div class="demo">
    <h1>Hello world!</h1>
    <resize-observer @notify="handleResize" />
  </div>
</template>

<script>
export default {
  methods: {
    handleResize ({ width, height }) {
      console.log('resized', width, height)
    }
  }
}
</script>

<style scoped>
.demo {
  position: relative;
}
</style>

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80