1.0.0 • Published 4 years ago

vue-resize-obsever v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Handle element resizes

Nowadays browsers have started to support element resize handling natively using ResizeObservers. We use this feature (with a polyfill) to help you handle element resizes in Vue.
No window.resize listeners! No timeouts! Just a pure implementation with a lightning-fast polyfill!

Installation

yarn add vue-resize-observer

Examples

Child Function Pattern

import { Component, Prop, Vue } from 'vue-property-decorator'
import ReactResizeDetector from 'vue-resize-observer'

@Component
class TestView extends Vue {
  render () {
    return (
      <div>
        ...
        <ReactResizeDetector handleWidth handleHeight onResize={this.onResize} />
      </div>
    )
  }

  onResize () {
    ...
  }
}

export default TestView

API

PropTypeDescriptionDefault
onResizeFuncFunction that will be invoked with width and height argumentsundefined
handleWidthBoolTrigger onResize on width changetrue
handleHeightBoolTrigger onResize on height changetrue
skipOnMountBoolDo not trigger onResize when a component mountsfalse

License

MIT

❤️

Show us some love and STAR ⭐ the project if you find it useful

1.0.0

4 years ago