Skip to content

Instantly share code, notes, and snippets.

@ederchrono
Created April 20, 2019 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ederchrono/db67522c972fe5fa68ac9d4d9d1ed0f0 to your computer and use it in GitHub Desktop.
Save ederchrono/db67522c972fe5fa68ac9d4d9d1ed0f0 to your computer and use it in GitHub Desktop.
// JS inside computed
menuItems () {
return itemsList.map((item, index) => {
const isSelected = this.selectedItem === index;
const otherButtonIsSelected = this.selectedItem !== -1
return {
label: item,
selected: isSelected,
dimmed: !isSelected && otherButtonIsSelected
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment