0.3.0 • Published 5 years ago

vue-resizesensor v0.3.0

Weekly downloads
14
License
MIT
Repository
github
Last release
5 years ago

vue-resizesensor

What's this ?

Vue component which provides element resize event. Based on ResizeSensor of css-element-queries

Requirement

Vue >= 2.3.0

USAGE

Vue.component("resize-sensor", require("vue-resizesensor"));

const MyComponent = Vue.extend({
    template: `
        <div style="display: relative;">
            <resize-sensor @resized="onResize" :debounce="50"></resize-sensor>
            <div>
                {{ width }} x {{ height }}
            </div>
        </div>
    `,
    data: function() {
        return { width: 0, height: 0 };
    },
    methods: {
        onResize: function() {
            this.width = this.$el.clientWidth;
            this.height = this.$el.clientHeight;
        }
    },
    attached: function() {
        this.width = this.$el.clientWidth;
        this.height = this.$el.clientHeight;
    }
});

NOTE: display of target element must be absolute or relative.

LICENSE

MIT

0.3.0

5 years ago

0.2.1

6 years ago

0.2.0

7 years ago

0.1.0

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago