Code Monkey home page Code Monkey logo

vue-media-query-mixin's Introduction

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="..." 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

vue-media-query-mixin's People

Contributors

dependabot[bot] avatar hxiongg avatar jofftiquez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vue-media-query-mixin's Issues

Wrong sizes for BS?

Hi,

please check this code.

The values for lg.max and xl.min are overlapping. In my eyes lg.max has to be set to 1199 and xl.min has to be set to 1200.

View media query stats when in dev mode

It would be useful to have a tiny overlay that displays media query stats (e.g. wXS: false, wXM: false) in the corner, similar to how Chromium shows a tiny overlay that displays the resolution if the window is resized while Chrome Dev Tools is open.

Such a feature should definitely only be active in dev mode. Maybe a dev option, so one can easily do:

// ...

Vue.use(VueMediaQueryMixin, {
  dev: process.env.NODE_ENV === 'development',

  // ...
});

or whatever condition is needed to specify dev mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.