Skip to content

givingwu/vue-size-observer

Repository files navigation

vue-size-observer

Resize observer for Vue - A vue component to observe the element size changing that implements by resize-observer-polyfill and inspired from rc-resize-observer.

Usage

CodeSandBox demo or run example in Terminal with npm:

npm install
npm run serve

Code example:

import ResizeObserver from 'vue-size-observer';

export default {
  render() {
    return (
      <ResizeObserver
        onResize={(rect) => {
          console.log('resized!', rect);
        }}
      >
        <textarea />
      </ResizeObserver>
    )
  }
}

API

Props

name type default description
disabled boolean false Disable current observer instance

Event

name type default description
resize ({ width, height, offsetWidth, offsetHeight })=>void -- Trigger resize listener function when child node resized

license

MIT