Nuxt/examples/vue-apollo/pages/index.vue

42 lines
588 B
Vue
Raw Normal View History

2017-04-14 10:52:27 +00:00
<template>
<div>
<h3>Cars</h3>
<ul>
<li v-for="car in allCars">
<nuxt-link :to="`car/${car.id}`">
{{ car.year }} {{ car.make }} {{ car.model }}
</nuxt-link>
</li>
</ul>
</div>
</template>
<script>
import allCars from '~/queries/allCars'
2017-04-14 10:52:27 +00:00
export default {
apollo: {
allCars: {
prefetch: true,
query: allCars
}
2017-04-14 10:52:27 +00:00
}
}
</script>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
line-height: 1.6;
}
a {
text-decoration: none;
color: #3498DB;
}
a:hover {
border-bottom: 1px solid;
}
</style>