Vue js in cordova Vue js in cordova vue.js vue.js

Vue js in cordova


See this article, it worked for me:

https://coligo.io/building-a-mobile-app-with-cordova-vuejs/

To allow the app to access the Vue.js library, we also need to add the following to the end of the Content Security Policy (CSP) meta tag in www/index.html:

; script-src 'self' http://cdn.jsdelivr.net/vue/1.0.16/vue.js 'unsafe-eval'


Looks like the issue was that Cordova.js is not included in browser, you need to test on a physical device.

That doesn't mean you can't prototype in the browser though. In JS, window.cordova will be defined if cordova has loaded. So you can setup your initialization like so

if(window.cordova){  //add deviceready event to start app} else {  //call starting function}

For things requiring a physical device: vibration, accelerometer, etc, you have to build and deploy to a device, the browser itself is not enough.