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">
|
2018-11-24 18:49:19 +00:00
|
|
|
<NuxtLink :to="`car/${car.id}`">
|
2017-04-14 10:52:27 +00:00
|
|
|
{{ car.year }} {{ car.make }} {{ car.model }}
|
2018-11-24 18:49:19 +00:00
|
|
|
</NuxtLink>
|
2017-04-14 10:52:27 +00:00
|
|
|
</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: {
|
2017-07-27 14:26:03 +00:00
|
|
|
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>
|