device icon indicating copy to clipboard operation
device copied to clipboard

Cannot read properties of undefined (reading 'isDesktop')

Open pit07 opened this issue 2 years ago • 1 comments

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 avatar Apr 05 '23 21:04 pit07

@pit07 hi! for nuxt v2 you should use npm i @nuxtjs/device@^2.1.0

deevanych avatar Apr 26 '23 14:04 deevanych

If installing Nuxt 2 version of the module doesn't work, let me know and I'll reopen this issue.

DamianGlowala avatar Apr 12 '24 18:04 DamianGlowala