Closed krodelabestiole closed 5 years ago
ok I found the issue had something to do with data vs computed tree : (and I lied a bit, I wasn't using the exact same code on codepen)
this works :
data () {
return {
pages: {
menu: [
{ title: 'wesh' },
{ title: 'io',
children: [{ title: 'poussin' }]
}
]
}
}
}
and this doesn't :
computed: {
pages() {
return {
menu: [
{ title: 'wesh' },
{
title: 'io',
children: [{ title: 'poussin' }]
}
]
}
}
}
unfortunately a search with "computed" in the issues doesn't show any other case...
I have updated my issue on codepen and this time I can reproduce my issue : https://codepen.io/krodelabestiole/pen/qQLeEq
...and I finally could resolve my issue with something like this :
data () {
return {
pages: cloneDeep(this.$store.state.tree)
}
},
computed: {
storeTree() {
return cloneDeep(this.$store.state.tree)
}
},
watch: {
storeTree(newValue) {
this.pages = newValue
}
}
this way I'm watching the store for changes, and re clone the tree if need
feel free to close if you don't need the tree to work as a computed property, and congrats for this great component :)
if you want to change tree data, you can traverse it and change node directly. My another library tree-helper is recommend to traverse tree data: https://github.com/phphe/tree-helper
Thanks @phphe , it's ok like that, no need for an extra library. I think my issue was more relative to VueJS in general than with your component specifically.
// UPDATE : you can read only the next message that is mode relevant
hi, and thanks for the great component !
I have a strange bug : when dragging I don't have any placeHolder showing, and when dropping nothing changes place.
The JS console doesn't show any error until drop then, when dropping on Firefox :
and on Chrome :
I tried to reproduce the bug for the purpose of this message on codepen and ... it works perfectly :/ https://codepen.io/krodelabestiole/pen/PxXveP
I was wondering if it has something to do with styles so I disabled every style with firefox, and it still works perfectly in codepen, and not in my app...
So I guess it might be incompatible with some library I am using or any variable name I gave that conflict with vdnt (a quick search shows I'm not using store, data nor vm)
Here are my dependencies in case it might be relevant :