Skip to content

Instantly share code, notes, and snippets.

@mathewsanders
Last active March 3, 2016 03:26
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 mathewsanders/99c8731e81de332e98a1 to your computer and use it in GitHub Desktop.
Save mathewsanders/99c8731e81de332e98a1 to your computer and use it in GitHub Desktop.
ContestList.vue template snippet
<!-- template code -->
<template>
<div>
<ul>
<!-- loop over parties -->
<li class="party" v-for="party in APIresponse.parties">
<h3>{{ party.name }} Party</h3>
<ol>
<!-- loop over contests for a party -->
<li class="contest" v-for="contest in party.contests">
<strong>{{ contest.contest_description }}</strong>
<ol>
<!-- loop over candidates for a contest -->
<li class="candidate" v-for="candidacy in contest.candidacies">
{{ candidacy.candidacy_name }} <em>{{ candidacy.group }}</em>
</li>
</ol>
</li>
</ol>
</li>
</ul>
<p style="color: blue;">{{ message }}</p>
<!--
<p style="font-size:0.5em; color: grey;">{{ APIresponse | json }}</p>
<p>{{ contestListInfo | json }}</p>
-->
</div>
</template>
@mathewsanders
Copy link
Author

Vue documentation for how to loop over arrays in template: http://vuejs.org/guide/list.html

@mathewsanders
Copy link
Author

artboard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment