You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/ajerez/vue-mobile-detection

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/ajerez/vue-mobile-detection

v0.0.0-20211029102045-b51f695cb5a1
Source
Go
Version published
Created
Source

IMPORTANT

Version 2 of this plugin only works with Vue 3. If you need Vue 2 compatibility install version 1.0.0

vue-mobile-detection

Vue.js global function this.$isMobile() that returns a Boolean value depending on whether or not the user is browsing with a mobile

NPM Version Twitter

Demo

https://ajerez.github.io/vue-mobile-detection/

Installation

npm i vue-mobile-detection

yarn

yarn add vue-mobile-detection

Usage

Plugin installation


import VueMobileDetection from "vue-mobile-detection";
import App from "./App.vue";

const app = createApp(App);
app.use(VueMobileDetection);

/* After the install you can use this.$isMobile() in all your vue components */

Using the plugin


<template>
  <div id="app">
    <!-- Use in template -->
    <div v-if="$isMobile()">MOBILE</div>
    <div v-else>DESKTOP OR TABLET</div>
  </div>
</template>

<script>
export default {
  created() {
    // Use in js
    console.log(this.$isMobile());
  }
};
</script>

License

This project is licensed under the terms of the MIT license

FAQs

Package last updated on 29 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts