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

45 lines
654 B
Vue
Raw Normal View History

2017-04-14 10:52:27 +00:00
<template>
<div>
<h3>Cars</h3>
<ul>
2017-11-26 13:40:57 +00:00
<li v-for="car in allCars" :key="car.id">
2017-04-14 10:52:27 +00:00
<nuxt-link :to="`car/${car.id}`">
{{ car.year }} {{ car.make }} {{ car.model }}
</nuxt-link>
</li>
</ul>
</div>
</template>
<script>
2017-08-03 09:20:05 +00:00
import allCars from '~/apollo/queries/allCars'
2017-04-14 10:52:27 +00:00
export default {
apollo: {
allCars: {
prefetch: true,
query: allCars
}
2017-08-03 09:20:05 +00:00
},
head: {
title: 'Cars with Apollo'
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>