Nuxt/examples/vue-apollo/pages/car/_id.vue

34 lines
569 B
Vue
Raw Normal View History

2017-07-26 09:34:41 +00:00
<template>
<section>
<article class="car-art">
<span>{{Car.make}}</span><br>
<span>{{Car.model}}</span><br>
<span>{{Car.year}}</span>
</article>
<nuxt-link to="/">Home</nuxt-link>
</section>
</template>
<script>
import gql from 'graphql-tag'
export default {
name: "Car",
apollo: {
Car: {
query: gql`query car($id: ID) {Car(id: $id) {make model year}}`,
variables () {
return {
id: this.$route.params.id
}
}
}
},
data () {
return {
Car: {}
}
}
}
2017-07-26 09:45:46 +00:00
</script>