docs(guide): remove defaultZoom opt from config guide

This commit is contained in:
braks
2023-11-08 16:55:53 +01:00
parent 26be5cf8d3
commit 91c521296d
+12 -28
View File
@@ -11,23 +11,10 @@ as options to the [`useVueFlow`](/guide/composables#usevueflow) composable.
```vue ```vue
<!-- Pass configuration as props --> <!-- Pass configuration as props -->
<template> <template>
<VueFlow :default-zoom="0.5" :max-zoom="4" :min-zoom="0.1" /> <VueFlow :default-viewport="{ zoom: 0.5 }" :max-zoom="4" :min-zoom="0.1" />
</template> </template>
``` ```
- Using Composable Options
```vue
<script setup>
import { useVueFlow } from '@vue-flow/core'
useVueFlow({
defaultZoom: 0.5,
maxZoom: 4,
minZoom: 0.1,
})
</script>
```
## Updating Config ## Updating Config
@@ -38,30 +25,27 @@ by `useVueFlow`.
```vue{2,5-6,10} ```vue{2,5-6,10}
<script setup> <script setup>
const defaultZoom = ref(1) const nodesDraggable = ref(false)
onMounted(() => { const toggleNodesDraggable = () => {
// change the default zoom value of the state // toggle the state
defaultZoom.value = 1 nodesDraggable.value = !nodesDraggable.value
}) }
</script> </script>
<template> <template>
<VueFlow :default-zoom="defaultZoom" /> <VueFlow :nodes-draggable="nodesDraggable">...</VueFlow>
</template> </template>
``` ```
- Using State (Composable) - Using State (Composable)
```vue{2,7-8} ```vue{2,5}
<script setup> <script setup>
const { defaultZoom } = useVueFlow({ const { nodesDraggable } = useVueFlow()
defaultZoom: 0.5,
})
onMounted(() => { const toggleNodesDraggable = () => {
// change the default zoom value of the state nodesDraggable.value = !nodesDraggable.value
defaultZoom.value = 1 }
})
</script> </script>
``` ```