Getting started
The guide assumes that you already have your base Vue app structure in place and are using NPM as your package manager.
-
Install package
At the command line run:
npm install @decodeuk/vdo-vue;
Note: You can use the appropriate save flags as required (–save or –save-dev). If using a build tool such as Parcel then use –save-dev.
-
Import into your main Vue application file
Add the following line towards the top of your Vue file:
import Vdo from '@decodeuk/vdo-vue';
-
Set Vue to use the Vdo plugin
Underneath, set Vue to use Vdo passing your apiKey as a value of the options object:
Vue.use(Vdo, {"apiKey": "<your-api-key>"});
-
You can now initialise Vdo within your App
Navigate to the place within your application you’d like to initialise Vdo. A good place for this would be the created() hook within your main App.vue (as shown below), however it could be done within a more specific component if only a small feature of the app.
created() { this.$vdo.setSessionId(<your-session-id>); this.$vdo.init(); }
Note: You can set the Session Id earlier in the lifecycle of your application if you know it. It can also be set as a sessionId property of your options object instead when calling the Vue.use() method earlier.
Next Steps
- Setting up Vdox (Vuex Plugin)
- Methods
- Session Ids
- User Tokens
- Components
- Events