Devices

Device detection module for Nuxt

Installation

npm i -D @nuxtjs/device

Setup

Add the following lines to the modules section of nuxt.config.{ts,js}

modules: ['@nuxtjs/device']

Demo

Device.vue
<template>
  <div>
    <template v-if="$device.isDesktop">
      Desktop
    </template>
    <template v-else-if="$device.isTablet">
      Tablet
    </template>
    <template v-else>
      Mobile
    </template>
  </div>
</template>
Desktop