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:
Braks
2021-12-20 19:29:52 +01:00
parent e64f6b7bc6
commit 7736915720
+5 -3
View File
@@ -11,11 +11,13 @@ export default (options?: FlowOptions): UseVueFlow => {
: false
if (!vueFlow || (vueFlow && options?.id && options.id !== vueFlow.id)) {
const name = options?.id ?? `vue-flow-${id++}`
const store = reactive(useStore(name, options))
const store = useStore(name, options)
vueFlow = {
id: name,
store,
...toRefs(store),
store: reactive(store),
...toRefs(store.state),
...store.getters,
...store.actions,
...store.hooksOn,
}
}