flagsmith-vue
v2.1.0
Published
Flagsmith Vue.js integration
Downloads
859
Readme
flagsmith-vue
An (unofficial) Flagsmith Vue.js integration that uses Vue Composition API to dynamically update feature flags and traits in components. Compatible with Vue.js versions
2.7
and3
.
Installation
npm install flagsmith-vue flagsmith
Usage
Initialize the integration with the useFlagsmith
helper in your root/parent component:
import { useFlagsmith } from 'flagsmith-vue'
useFlagsmith(options)
For options
see Flagsmith initialization options.
Then you can access the flags, traits, loading status and the Flagsmith instance itself inside your child components:
import { useFlags, useTraits, useFlagsmithLoading } from 'flagsmith-vue'
const flags = useFlags(['flag1', 'flag2', ...])
const traits = useTraits(['trait1', 'trait2', ...])
const flagsmithLoading = useFlagsmithLoading()
const { setTraits } = useFlagsmithInstance()
License
Unless otherwise noted, all source code is licensed under the MIT License.
Copyright (c) 2024 Jochen Hörmann