[Vuejs]-How to pass vuejs element instance by reference

0👍

So i would approach this like this, keeps the concerns more separate

  • on each of the chips, have a selected that is false by default
  • add an @click=setSelected(chip)
  • in your setSelected, set the value of the one selected to be true and the others to be false

If you don’t want to set a value on the chips you could also keep a completely separate variable that is selectedChip that holds the value of the selected chip. You setSelected would then change the value of selectedChip. You would also need to pass selectedChip into your loop so that you can handle the display if the current chip is selected

Leave a comment