Skip to content

Instantly share code, notes, and snippets.

@chaeyeonhan1225
Created June 3, 2021 05:40
Show Gist options
  • Save chaeyeonhan1225/fb59d0a795486d9582d468fc1056578c to your computer and use it in GitHub Desktop.
Save chaeyeonhan1225/fb59d0a795486d9582d468fc1056578c to your computer and use it in GitHub Desktop.
Apollo Query Variables
<template>
<div>
<div v-if="user">
<h5>{{ user.id }}</h5>
<h5>{{ user.name }}</h5>
<h5>{{ user.age }}</h5>
</div>
</div>
</template>
<script lang="ts">
import gql from "graphql-tag";
import Vue from "vue";
export default Vue.extend({
apollo: {
user: {
query: gql`
query user($id: ID!) {
user(id: $id) {
id
name
age
}
}
`,
variables: {
id: 1,
},
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment