In Windows, you have the ability to select a folder by clicking on it once.
Currently, I am using Vuejs. I am interested in coding the same functionality with multiple arrays retrieved from my database and displayed using v-for
.
My idea is to add a new column (select) to each array with a default value of 0
. Then, I can implement a function that changes the select value to 1
when clicked, as well as apply a CSS class for visual distinction (such as blue border color).
At present, the element with the select column value of 1
is considered selected.
The process becomes more complex when trying to change the selection (i.e., selecting another array). I would need to first set all select columns' values to 0
, remove any applied CSS classes, and then proceed with the new operation (as only one element should be selected at a time).
Any advice on how to achieve this? Thank you.