chore(svelte-readme): update example
This commit is contained in:
@@ -24,13 +24,11 @@ A basic flow looks like this:
|
|||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
import {
|
import {
|
||||||
SvelteFlow,
|
SvelteFlow,
|
||||||
SvelteFlowProvider,
|
|
||||||
Controls,
|
Controls,
|
||||||
Background,
|
Background,
|
||||||
BackgroundVariant,
|
BackgroundVariant,
|
||||||
MiniMap,
|
MiniMap,
|
||||||
Panel,
|
type SnapGrid
|
||||||
type NodeTypes
|
|
||||||
} from '@xyflow/svelte';
|
} from '@xyflow/svelte';
|
||||||
|
|
||||||
// We are using writables for the nodes and edges to sync them easily. When a user drags a node for example, Svelte Flow updates its position.
|
// We are using writables for the nodes and edges to sync them easily. When a user drags a node for example, Svelte Flow updates its position.
|
||||||
@@ -60,16 +58,12 @@ A basic flow looks like this:
|
|||||||
label: 'Edge Text'
|
label: 'Edge Text'
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const snapGrid = [25, 25];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SvelteFlow
|
<SvelteFlow
|
||||||
{nodes}
|
{nodes}
|
||||||
{edges}
|
{edges}
|
||||||
{nodeTypes}
|
|
||||||
fitView
|
fitView
|
||||||
snapGrid={snapGrid}
|
|
||||||
on:nodeclick={(event) => console.log('on node click', event)}
|
on:nodeclick={(event) => console.log('on node click', event)}
|
||||||
>
|
>
|
||||||
<Controls />
|
<Controls />
|
||||||
|
|||||||
Reference in New Issue
Block a user