0

Is it possible to add a tree like here with components? I have a structure with organisations, organisation units and section. I want to show them organised.

It temporary looks like this:

this

One input-group example:

<b-input-group prepend="Org">
     <b-form-input v-model="org.name"></b-form-input>
     <b-input-group-append>
         <b-btn variant="outline-danger">Delete</b-btn>
         <b-btn v-on:click="editOrg(org.id, org.name)" variant="outline-success">Save</b-btn>
     </b-input-group-append>
</b-input-group>

1 Answer 1

2

Yes it is possible, I recently created a drag and drop menu builder using recursive components. Here is a good tutorial that can walk you through how to handle that part: https://alligator.io/vuejs/recursive-components/

Once you have an understanding of how recursive components work you should be able to build your array and nest any content you want, i.e. <input> elements inside of your list. Then just reference the input by a key, to bind the input to the item in your array.

Sign up to request clarification or add additional context in comments.

2 Comments

The loading works now, but I can't get the opening/closing to work. I want to open/close it by clicking an icon on the left or the prepended text.
This gets tricky, you can use @click to pass the index and then set the toggle up as an array, then just toggle like any other component.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.