butterfly
butterfly copied to clipboard
Can't update canvas after updating in Vue
The current behavior
I currently have this callback in Vue component:
changeForce() {
console.log(this.canvas.layout.options.link.strength = this.forceValue)
this.resetCanvas()
}
and this function used to allow me update the graph
resetCanvas() {
this.key = ""
this.data = {};
this.$nextTick(() => {
this.data = this.dataCopy
})
},
but it doesn't work anymore in "butterfly-dag": "^4.1.4" and "butterfly-vue": "1.0.4",
The expected behavior
I'm expecting to update the layout like before
Your environment(such as: Butterfly version、Browser version、OS and so on)
Butterfly version
:
"butterfly-dag": "^4.1.4" and "butterfly-vue": "1.0.4",
Browser version
:
Chrome lastest
OS
: Windows 10
Steps To Reproduce, Maybe you can provide a simple demo.
OK ,I know.I will reply to you or provide you with a solution after fix this.x
Okay thanks ! Would be great to have a fix even if it's not perfect.
now,You can try this.in 1.0.4.
because:
watch is this,
Modify canvasData directly, and this operation will not be monitored。
Modifying the array directly will not be monitored. This is a flaw in Vue's listening for array operations。
don't like this
The array method overridden by Vue must be used to trigger the listening event。
from:https://github.com/vuejs/vue/blob/dev/src/core/observer/array.js
Later TODO:
Support :Direct modification canvasData
Should be supported in 1.0.5
I gt this error in the console unfortunately : vue.esm.js?a026:628 [Vue warn]: Error in callback for watcher "nodes": "Error: node not found: 0"
found in
vue.esm.js?a026:628 [Vue warn]: Error in callback for watcher "nodes": "Error: node not found: 0"
found in
---> <ButterflyVue>
<App> at src/App.vue
<Root>
.... Error: node not found: 0
Can you provide the following demo or code to reproduce? This error does not appear when I use。