Skip to content

Instantly share code, notes, and snippets.

@harrybeckwith
Created August 2, 2019 09:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harrybeckwith/c9e7f9ee4fbbe98b275bfc6ea952f18e to your computer and use it in GitHub Desktop.
Save harrybeckwith/c9e7f9ee4fbbe98b275bfc6ea952f18e to your computer and use it in GitHub Desktop.
v-for vue template
<template>
<div>
<div
v-for="(item, i ) in items"
:key="i"
:class="{ active: i === activeItem}"
>
// some looped items from data here
// button for active toggle
<button @click="selectItem(i)"> make item active </button>
</div>
</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment