Created
June 3, 2021 05:40
-
-
Save chaeyeonhan1225/fb59d0a795486d9582d468fc1056578c to your computer and use it in GitHub Desktop.
Apollo Query Variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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