How do you actually use Onsen with Vue.js and Cordova?



  • Hello,
    I am following this guide:

    https://onsen.io/v2/guide/vue/index.html#vue-js

    But I don’t understand how I am using cordova in there. I used the tool before and I had all the nice commands like “cordova platform add android” or “cordova build android”, but the example only resembles of a js application with a cordova directory structure.

    Anybody knows how I can actually build an app for android? The guide is pretty misleading.


  • Onsen UI

    @LuCavallin If you are using the template mentioned in that pretty misleading guide, you just need to build it via npm run build in order to create the www folder with all the generated code from src folder. That’s the last requirement to have a Cordova project and you’ll be able to run cordova platform add android and the like.

    Just in case, that template is not installing Cordova or Android Studio. You need to do it yourself. For an easier solution, have a look at Monaca CLI (the link is actually provided after you install the template).



  • @Fran-Diox Do you know if it’s possible to integrate Cordova when I run npm run dev such that I can test out functions provided by their API without having to compile it every time?


  • Onsen UI

    @edgegfx Not in the browser. I think the easiest way is running npm run build:watch and use Monaca Debugger, as explained in the link I provided in the last post. It will refresh the app automatically in your device.



  • @Fran-Diox Thanks, will do. I’m struggling to get ons.ready into my Vue project. Do you know where I would integrate that and how the code should look like?


Log in to reply