device
device copied to clipboard
Cannot read properties of undefined (reading 'isDesktop')
Hi!
On Nuxt 2, I install the package
npm install -D @nuxtjs/device
I added '@nuxtjs/device', on the buildModules array (nuxt.config.js)
I just added this code to my page:
<div v-if="$device.isDesktop">
Desktop
</div>
<div v-else-if="$device.isTablet">
Tablet
</div>
<div v-else>
Mobile
</div>
And i have an error: Cannot read properties of undefined (reading 'isDesktop')
Any ideas? Thanks!
@pit07 hi! for nuxt v2 you should use npm i @nuxtjs/device@^2.1.0
If installing Nuxt 2 version of the module doesn't work, let me know and I'll reopen this issue.