vue-computed-dimensions

A mixin which allows component HTML dimensions (width, height, x and y positions) to be used in computed properties
7,109
Install
npm install vue-computed-dimensions
Latest Version:0.1.0
License:MIT
Last Updated:Nov 17, 2021
Links: npm
Maintainer: circuit8

Vue Computed Dimensions

This library provides a mixin which allows component HTML dimensions (width, height, x and y positions) to be used in computed properties of Vue components.

yarn add vue-computed-dimensions

or

npm install vue-computed-dimensions

Examples

<template>
  <div ref="wrapper">
    ...

    <div ref="other">...</div>
  </div>
</template>

<script>
import computedDimensions from "vue-computed-dimensions";

export default {
  // computedDimensions accepts a list of refs to use.
  // each ref provided will produce 4 computed properties
  // in this example we will have wrapperWidth wrapperHeight wrapperX and wrapperY. As well as otherWidth, otherHeight, otherX, and otherY.
  // these can then be used in other computed properties to base reactivity on the rendered dimensions of an element
  mixins: [computedDimensions("wrapper", "other")],
};
</script>

Related Packages

vue-update-query-mixin

Provided this.updateQuery(Object) mixin for updating query string, for Vue 1.x|2...

8,772 2
vue-undo-redo-stack

A simple Vue Mixin that adds an undo/redo stack to any Vue Component

6,453 8
vue-resize-on-event

Vuejs directive that resizes on an event (e.g. textarea)

311
vue-smooth-reflow

Transition reflow in response to vue data changes.

1,234,774 442
@vue-interface/variant

The contextual variant mixin for interface components.

1,925 0

Version History

Version Released License
0.1.0 MIT