update: merge props with state objects
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -105,7 +105,11 @@ const { store, hooks } = initFlow(emit, props)
|
|||||||
const init = (opts: typeof props) => {
|
const init = (opts: typeof props) => {
|
||||||
for (const opt of Object.keys(opts)) {
|
for (const opt of Object.keys(opts)) {
|
||||||
const val = opts[opt as keyof FlowProps]
|
const val = opts[opt as keyof FlowProps]
|
||||||
if (val && typeof val !== 'undefined') (store.$state as any)[opt] = val
|
if (val && typeof val !== 'undefined') {
|
||||||
|
if (typeof val === 'object' && !Array.isArray(val)) {
|
||||||
|
;(store.$state as any)[opt] = { ...(store.$state as any)[opt], ...val }
|
||||||
|
} else (store.$state as any)[opt] = val
|
||||||
|
}
|
||||||
}
|
}
|
||||||
store.setElements(store.elements)
|
store.setElements(store.elements)
|
||||||
store.setMinZoom(opts.minZoom)
|
store.setMinZoom(opts.minZoom)
|
||||||
|
|||||||
Reference in New Issue
Block a user