vue-media-query-mixin

A vue mixin to get current media query, xs, sm, md and lg.
988 27
Install
npm install vue-media-query-mixin
Latest Version:0.1.0
License:MIT
Last Updated:Dec 6, 2022
Links: GitHub  ·  npm
Maintainer: cent1pede

vue-media-query-mixin

A vue mixin to get current media query, xs, sm, md, lg and xl.

Installation

NPM

npm install vue-media-query-mixin

YARN

yarn add vue-media-query-mixin

Installation

import Vue from 'vue';
import VueMediaQueryMixin from 'vue-media-query-mixin';

Vue.use(VueMediaQueryMixin, {framework:'vuetify'});

I added the framework option because there are css framework that have different media query breakpoints. E.g. bootstrap's xs is <=575 while on vuetify xs is <=599.

Frameworks Supported

Will use vuetify as default when "options" was omitted.

  1. vuetify
  2. bootstrap

Usage

JS

this.wXS // boolean

TEMPLATE

{{ wXS }} // boolean

<img src="https://raw.githubusercontent.com/jofftiquez/vue-media-query-mixin/HEAD/..." v-if="wXS"> // visible only on XS devices.

API

data description
windowWidth number
windowHeight number
wXS boolean
wSM boolean
wMD boolean
wLG boolean
wXL boolean

Related Packages

vue-update-query-mixin

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

8,772 2
vue3-mq

Build responsive design into your Vue 3 app

563,882 45
@nanostores/media-query

A smart store for Nano Stores state manager to sync with some media query

164,218 22
vital-mq

Build responsive design into your Vue3 app

419 45
vue-computed-dimensions

A mixin which allows component HTML dimensions (width, height, x and y positions...

7,109

Version History

Version Released License
0.1.0 MIT
0.0.4 MIT
0.0.3 MIT
0.0.2 MIT
0.0.1 MIT