diff --git a/examples/UpdateNode/UpdateNodeExample.vue b/examples/UpdateNode/UpdateNodeExample.vue index c4c4ae88..16787a60 100644 --- a/examples/UpdateNode/UpdateNodeExample.vue +++ b/examples/UpdateNode/UpdateNodeExample.vue @@ -10,9 +10,11 @@ const initialElements: Elements = [ ] const elements = ref(initialElements) -const nodeName = ref('Node 1') -const nodeBg = ref('#eee') -const nodeHidden = ref(false) +const opts = ref({ + bg: '#eee', + name: 'Node 1', + hidden: false, +}) const updateNode = () => { elements.value = elements.value.map((el) => { @@ -20,29 +22,30 @@ const updateNode = () => { // it's important that you create a new object here in order to notify react flow about the change el.data = { ...el.data, - label: nodeName.value, + label: opts.value.name, } - el.style = { backgroundColor: nodeBg.value } - el.isHidden = nodeHidden.value + el.style = { backgroundColor: opts.value.bg } + el.isHidden = opts.value.hidden } return el }) } + onMounted(updateNode)