1.2.5 • Published 2 years ago

@luaguillande/screen-checker v1.2.5

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

Screen Checker

Vue Plugin to help you to identify the size of the screen without complexity.

Quick start guide

1. Add the plugin to your project

  npm i @luaguillande/screen-checker

Option 1: If you are using Nuxt.js you can import a plugin to inject the property $sc to your Vue instances.

  plugins: [
      { src: '~/node_modules/@luaguillande/screen-checker/checkScreenPlugin.js'}
  ]

Option 2: Import as Mixin

If you are not using a Nuxt environment or if you want to import individually into components use the Mixin.

  <scprit>
  import checkScreenMixin from '@luaguillande/screen-checker/checkScreenMixin.js'

  export default {
       mixins:[checkScreenMixin]
  }
  </scprit>

or

  <scprit>
  import checkScreenMixin from '@luaguillande/screen-checker/checkScreenMixin.js'

  Vue.mixins(checkScreenMixin)
  </scprit>

Use in html.

<div :class="{ 'some-class': $sc.desktopAndUp,  'another-class': $sc.tabletAndDown}">
<button :v-html="$sc.largeTabletAndDown ? 'Click here' : 'Click here to send me a text' "></button>
<img :src="my logo" v-if="$sc.isLargeDesktop"/>
<div v-else>My Logo Text </div>

Use in js.

<script>
export default{
  methods:{
    myFn(value){
      return this.$sc.largeTabletAndDown ? value : 'Not mobile'
    }
  }
}
<script>

Note: If you are using as a Nuxt injection use '$sc' else use 'sc'.

4. Boundaries

Option 1: Specific range

PropertyMin SizeMax Size
isLargeDesktop1600px8200px
isDesktop1280px1599px
isLargeTablet1024px1279px
isTablet768px1023px
isCell250px767px

Option 2: Screen size bigger than

PropertyMin Size
largeDesktopAndUp1600px
desktopAndUp1280px
largeTabletAndUp1024px
tabletAndUp768px1023px
cellAndUp250px

Option 3: Screen size smaller than

PropertyMax Size
largeDesktopAndDown8200px
desktopAndDown1599px
largeTabletAndDown1279px
tabletAndDown1023px
cellAndDown767px

@luaguillande - 31solutions.com

You might like!

Scss Helpers Library

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago