cordova is not defined"
-
Hello guys,
I have installed Quasar just the way its recommended in the Doc , and then I added a cordova plugin ,
I checked in the cordova xml file the plugin exsist , when I do cordova plugins in CLI it properly list the plugin ,
But when I tried to acces the plugin in App.vue componenet inside mounted hook ,
console.log(cordova)
It says cordova is not defined"
any Idea what could have gone wrong
-
Are you using 0.13.10 or 0.14 beta? I think these instruction should work for either http://beta.quasar-framework.org/guide/cordova-wrapper.html
Assuming you have cordova installed & up to date, go into your quasar project folder. Run
quasar wrap cordova; quarsar build
, thencd cordova
and thencordova platform add android
, and thencordova run
.Whenever you edit your quasar project, you will need to run
quasar build
again, and since/dist/
and/cordova/www/
are symlinked you just need to go into/cordova/
and runcordova run
to test it out on your phone again. You shouldn’t need to modify any files in/cordova/www/
, because if you do they will be overwritten.
Also for future reference you’d want to post this under the Help Category
-
Without trying myself, but according to the docs http://beta.quasar-framework.org/components/vue-prototype-injections.html#Mobile-Apps
it should be$cordova
(note the $ sign). Also if you call it from within a component, it should bethis.$cordova
-
-
I am using 0.13.10 I have already followed the steps provided and I am still getting cordova undefined
-
I think the application only knows Cordova when you’re debugging from the cordova app. When do you try to call
this.$cordova
? -
-
@JCharante Hey so did this work for you ? I see some commits .
@eleina so JC has forked my repo and did some changes have a look on that one , I ran the app in My mobile app and tried testing through the remote device debuggin tool of chrome , I get following error
vendor.js:11 Uncaught TypeError: e.$parent.close is not a function at click (vendor.js:11) at HTMLButtonElement.t (vendor.js:6)
and cordova undefined
-
@vikram Try using crosswalk with cordova https://crosswalk-project.org/
-
The answer to this is to use navigator instead of the cordova keyword to access plugins i.e. you can use
navigator.camera.getPicture()
to use the camera plugin.see issue #792 for clarification of this: https://github.com/quasarframework/quasar/issues/792
-
If it’s related to #792 please note that “cordova” is available, but when using a Cordova plugin please read each plugin’s documentation page.
-
This post is deleted!