platform.is response is undefined with Vue CLI 3
-
Hello,
I use Vue CLI 3 plugin and platform.is in state.js file, but it response is undefined.export default {
preferences: {
platform: Platform.is, // this.$q.platform.is.desktop
fullScreen: AppFullscreen.isActive // this.$q.fullscreen.isActive
}
}It will not fail when I use it in .vue file (this.$q.platform.is.desktop)
export default { name: 'Home', data() { return { leftDrawerOpen: this.$q.platform.is.desktop } }, methods: { openURL } }
I’m using:
–Vue version 3.0.5
–Quasar-framework version 0.17.17Similarly create a template with Quasar CLI everything is normal no errors.
Please give me information to solve this problem. Thanks
-
I don’t think Quasar globals will be available anywhere else other than in components within a Vue project.
I don’t even understand why this version of Quasar is offered. It is a patch for a problem that I don’t know of and only causes confusion, when it is used. At least I don’t understand what problem the Quasar plugin is solving.
Quasar IS Vue, so there is no reason to patch it/ plug it into Vue.
Scott
-
Hi Scott,
I would like to mention a problem, when using Vue CLI 3 to build project with quasar framework. Can not retrieve this $ q.platform.is in .js files. Is there a difference between Quasar CLI and Vue CLI.
Thanks
-
Yes. Quasar CLI is built for Quasar. The Vue CLI is built for Vue. If you want all the features of Quasar, it’s best to use the Quasar CLI.
Scott
-
$q only work inside .vue files, if you like to use it then you’ll need to do an import in your .js file.
ie:
//somefile.js
import { Platform } from ‘quasar’
isMobile() {
return Platform.is.mobile
}https://quasar-framework.org/components/platform-detection.html