The Unleash Vue SDK lets you evaluate feature flags in Vue applications. It connects to Unleash or Unleash Edge to fetch evaluated flags for a given Unleash context.
You can use this SDK with Unleash Enterprise or Unleash Open Source.
For an overview of how Unleash SDKs work, including offline behavior, feature compatibility across SDKs, and default refresh and metrics intervals, refer to the SDK overview.
Or use the FlagProvider component like this in your entrypoint file (typically App.vue):
Or, using FlagProvider:
By default, the Unleash client will start polling for toggles immediately when the FlagProvider component renders. You can delay the polling by:
startClient prop to falseFlagProviderDeferring the client start gives you more fine-grained control over when to start fetching the feature toggle configuration. This could be handy in cases where you need to get some other context data from the server before fetching toggles, for instance.
To start the client, use the client’s start method. The below snippet of pseudocode will defer polling until the end of the asyncProcess function.
To check if a feature is enabled:
To check variants:
useFlagsStatus retrieves the ready state and error events. Follow the following steps in order to delay rendering until the flags have been fetched.
Follow the following steps in order to update the unleash context:
The Developer Toolbar provides runtime flag overrides during development.
Refer to the complete Vue example on GitHub for a full implementation.