0.0.3 • Published 8 years ago

vue-cordova-device v0.0.3

Weekly downloads
18
License
MIT
Repository
github
Last release
8 years ago

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.