wangweiwei / vue-resize-observer

Vue Resize Observer
MIT License
61 stars 9 forks source link

logo

Vue Resize Observer

Latest Version on NPM vue2 vue3 Issue Software License Contributors Anon Code Size
Downloads Languages Count Languages Examle Online

English | 简体中文

demo gif

Installation

Module import & Example

const VueResizeObserver = require("vue-resize-observer");
// Vue3.0
const app = createApp(App)
app.use(VueResizeObserver) // use is a instance's method & be called before mount
app.mount('#app')
// Vue2.0
Vue.use(VueResizeObserver); // use is a static method

or

import VueResizeObserver from "vue-resize-observer";
Vue.use(VueResizeObserver);
// Vue3.0
const app = createApp(App)
app.use(VueResizeObserver) // use is a instance's method & be called before mount
app.mount('#app')
// Vue2.0
Vue.use(VueResizeObserver); // use is a static method

or

import VueResizeObserver from "vue-resize-observer";
// Vue3.0
Vue.createApp({
  directives: { 'resize': VueResizeObserver },
})
// Vue2.0
new Vue({
  directives: { 'resize': VueResizeObserver },
})

## Example

[![Example Online](https://img.shields.io/badge/-Example--Online-blue?style=for-the-badge&logo=internet-explorer)](https://www.ellow.cn/examples/vue-resize-observer/index.html)

## Documentation

``` sh
npm run doc

Or read the documentation online

Read the Docs Online

⚠️ Notice

Set the v-resize directive for a DOM element and make the element position to something other than 'static' (for example 'relative').

Dependency

Dependency Status devDependency Status

License

Software License

Copyright (c) 2020-present, Wayne