samedi 25 septembre 2021

How to unselect a components of same type in a parent component when other component is clicked - Vue. options api PATTERN?

Bassicaly, I would like to know your way, how would you approach unselecting all previously selected components(bind css selectedClass to class element property ).

My solution: childComponent aka product-tab deals with changing its own class @clik binding data and passing event to parent with clicked tab.

          ParentComponent - $refs all child components, than foreach loop , than change data like this ..this.$refs.tab1.selectedClass = "";

I am a begginer in Vue so please any help wit many possible solutions to this and similar problems.

Aucun commentaire:

Enregistrer un commentaire