nuxt-modules / device

Nuxt module for detecting device type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read properties of undefined (reading 'isDesktop')

pit07 opened this issue · 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 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.