examples: Update node example color
This commit is contained in:
@@ -9,8 +9,8 @@ const initialElements: Elements = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const elements = ref<Elements>(initialElements)
|
const elements = ref<Elements>(initialElements)
|
||||||
const opts = ref({
|
const opts = reactive({
|
||||||
bg: '#eee',
|
bg: '#eeeeee',
|
||||||
name: 'Node 1',
|
name: 'Node 1',
|
||||||
hidden: false,
|
hidden: false,
|
||||||
})
|
})
|
||||||
@@ -19,9 +19,9 @@ const updateNode = () => {
|
|||||||
elements.value.forEach((el) => {
|
elements.value.forEach((el) => {
|
||||||
if (el.id === '1') {
|
if (el.id === '1') {
|
||||||
// it's important that you create a new object here in order to notify react flow about the change
|
// it's important that you create a new object here in order to notify react flow about the change
|
||||||
el.label = opts.value.name
|
el.label = opts.name
|
||||||
el.style = { backgroundColor: opts.value.bg }
|
el.style = { backgroundColor: opts.bg }
|
||||||
el.hidden = opts.value.hidden
|
el.hidden = opts.hidden
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user