N00ts / vue3-treeview

a simple treeview in vue js 3
MIT License
73 stars 65 forks source link

Set attribute "data-node-id" on each node #21

Open Geoffrey-D opened 2 years ago

Geoffrey-D commented 2 years ago

This facilitate DOM manipulation :)

N00ts commented 2 years ago

Hello, since vue js is based on data mutation for DOM manipulation (virutal DOM), i'm not sure having an ID for manipulation is relevant. Why did you put "data-node-id" instead of a real :id ? What is your use case ?

Geoffrey-D commented 2 years ago

I need to open and focus nodes programatically, and as no "API" allowed such things, I had to:

I have added in this MR 2 API methods to do those things in an "API" object:

this.$refs.Tree.API.open(id);
this.$refs.Tree.API.focus(id);

I have also changed the "data-node-id" attr to "id" as it makes more sense

Geoffrey-D commented 2 years ago

What do you think of those 2 features? Can we merge them?

Geoffrey-D commented 2 years ago

Hey @N00ts could you please give a feedback on this?

Thx :)

N00ts commented 2 years ago

Hey I had a look to your PR. I have multiple remarks.