vue-configuration
A static config plugin.
Installation
Add package
yarn add vue-configuration # or via npm: npm i vue-configuration
Install plugin
;;; // pass config object to the pluginVue;
Usage
Access config values in any part of app using simple API:
this$config;
Use dot-notation for keys:
this$config;
Default values if value not set:
this$config;
Replace config:
this$config;
Test if path exists:
// obj = { a: 1 }this$config; // falsethis$config; // true
Get config object:
this$configall;
Example
config.js
facebook: apiToken: 'abc' clientSecret: 'topsecret' allowRegistration: true;
Get node:
this$config;// { apiToken: 'abc', clientSecret: 'topsecret' }
Read Facebook's API token in component:
this$config;// 'abc'
Test if registration is open:
this$config;// true
Test if login is available:
this$config;// oops, not defined! return "false" as default