Skip to content

Commit 1006006

Browse files
committed
chore(examples): add cdn example file
1 parent fc2f36b commit 1006006

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

docs/examples/custom-node/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function onGradient() {
112112
fit-view-on-init
113113
>
114114
<template #node-color-selector="{ data }">
115-
<ColorSelectorNode :data="data" @change="onChange" @gradient="onGradient" />
115+
<ColorSelectorNode :data="data" />
116116
</template>
117117

118118
<MiniMap :node-stroke-color="nodeStroke" :node-color="nodeColor" />
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
<script setup>
2-
const props = defineProps();
2+
import { useHandleConnections, useNodesData } from '@vue-flow/core'
33
4-
const { }
4+
const props = defineProps({
5+
id: {
6+
type: String,
7+
required: true,
8+
},
9+
})
10+
11+
const connections = useHandleConnections({
12+
nodeId: props.id,
13+
type: 'target',
14+
})
15+
16+
const data = useNodesData()
17+
</script>

examples/vite/index-cdn.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
7+
<script src="https://cdn.jsdelivr.net/npm/@vue-flow/[email protected]/dist/vue-flow-core.iife.min.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/@vue-flow/[email protected]/dist/vue-flow-background.iife.min.js"></script>
9+
<link href="https://cdn.jsdelivr.net/npm/@vue-flow/[email protected]/dist/style.css" rel="stylesheet">
10+
<link href="https://cdn.jsdelivr.net/npm/@vue-flow/[email protected]/dist/theme-default.min.css" rel="stylesheet">
11+
</head>
12+
<body>
13+
<div id="app" style="height: 100vh"></div>
14+
15+
<script>
16+
const { ref, createApp, h } = Vue
17+
const { VueFlow } = vueFlowCore
18+
19+
const app = createApp({
20+
setup() {
21+
const elements = ref([
22+
{ id: '1', type: 'input', label: 'Node 1', position: { x: 250, y: 5 } },
23+
{ id: '2', label: 'Node 2', position: { x: 100, y: 100 } },
24+
{ id: '3', label: 'Node 3', position: { x: 400, y: 100 } },
25+
{ id: '4', type: 'output', label: 'Node 4', position: { x: 400, y: 200 } },
26+
{ id: 'e1-3', source: '1', target: '3' },
27+
{ id: 'e1-2', source: '1', target: '2', animated: true },
28+
])
29+
30+
return () => h(VueFlow, { modelValue: elements.value })
31+
},
32+
})
33+
34+
app.mount('#app')
35+
</script>
36+
</body>
37+
</html>

examples/vite/src/CustomNode/ColorSelectorNode.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
<div>
3131
Custom Color Picker Node: <strong>{{ data.color }}</strong>
3232
</div>
33+
3334
<input class="nodrag" type="color" :value="data.color" @input="props.data.onChange" />
3435
<Handle id="a" type="source" :position="Position.Right" :style="sourceHandleStyleA" />
3536
<Handle id="b" type="source" :position="Position.Right" :style="sourceHandleStyleB" />

0 commit comments

Comments
 (0)