Set up Vue SDK

Install the package

$yarn add launchdarkly-vue-client-sdk

Initialize the SDK

Vue SDK initialization
1// Add the code below to your main.js file.
2import { createApp } from 'vue';
3import App from './App.vue';
4import { LDPlugin } from 'launchdarkly-vue-client-sdk';
5
6const app = createApp(App);
7
8// A "context" is a data object representing users, devices, organizations, and other entities.
9const context = {
10 kind: 'user',
11 key: 'EXAMPLE_CONTEXT_KEY',
12 name: 'Sandy',
13};
14
15// This is your client-side ID.
16app.use(LDPlugin, {
17 clientSideID: 'YOUR_CLIENT_SIDE_ID',
18 context: context
19});
20
21app.mount('#app');

You can find your server-side SDK keys, mobile keys, and client-side ID on the SDK keys page under Settings.

To learn more, read Initialize the client and context in the Vue SDK reference guide.