vue-cordova-device

vue-cordova-device JS library on GitHub vue-cordova-device JS library on npm Download vue-cordova-device JS library

Vue.js plugin for Cordova Device plugin

Version 0.0.3 License MIT Vulnerabilities 0
vue-cordova-device has no homepage
vue-cordova-device JS library on GitHub
vue-cordova-device JS library on npm
Download vue-cordova-device JS library
Keywords
cordovavuejsplugindevicemobile

Vue.js plugin for Cordova Device plugin

How to use

Add the NPM package to your project

npm install --save vue-cordova-device

Add the plugin to your Vue instance according to your setup

// CommonJS
var Vue = require('vue');
var VueCordovaDevice = require('vue-cordova-device');
Vue.use(VueCordovaDevice);

// import
import Vue from 'vue'
import VueCordovaDevice from 'vue-cordova-device'
Vue.use(VueCordovaDevice)

Access the device information through the global Vue object

console.log(Vue.cordova.device);

A Vue.cordova object is created on top of the Vue.cordova.device object that you are looking for. This may be used by other Vue Cordova plugins or by the Vue Cordova Suite.

Note : Install the Cordova Device plugin prior to build your Cordova app, obviously.

cordova plugin add cordova-plugin-device

Troubleshooting

Vue.cordova.device contains only null values

This information is not available until Cordova has triggered the deviceready event. So the data would not be available immediately. More information about that on the Cordova Device plugin page.

Otherwise, the Cordova plugin might not be installed. Run cordova plugin add cordova-plugin-device and try again.