feat(flow): Add state as refs, getters and actions to vueFlow object for easier access
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -11,11 +11,13 @@ export default (options?: FlowOptions): UseVueFlow => {
|
|||||||
: false
|
: false
|
||||||
if (!vueFlow || (vueFlow && options?.id && options.id !== vueFlow.id)) {
|
if (!vueFlow || (vueFlow && options?.id && options.id !== vueFlow.id)) {
|
||||||
const name = options?.id ?? `vue-flow-${id++}`
|
const name = options?.id ?? `vue-flow-${id++}`
|
||||||
const store = reactive(useStore(name, options))
|
const store = useStore(name, options)
|
||||||
vueFlow = {
|
vueFlow = {
|
||||||
id: name,
|
id: name,
|
||||||
store,
|
store: reactive(store),
|
||||||
...toRefs(store),
|
...toRefs(store.state),
|
||||||
|
...store.getters,
|
||||||
|
...store.actions,
|
||||||
...store.hooksOn,
|
...store.hooksOn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user