Skip to content

Instantly share code, notes, and snippets.

@chaeyeonhan1225
Last active June 3, 2021 04:19
Show Gist options
  • Select an option

  • Save chaeyeonhan1225/9a0e3a6fa81de6be262ccbdd9c8f67f4 to your computer and use it in GitHub Desktop.

Select an option

Save chaeyeonhan1225/9a0e3a6fa81de6be262ccbdd9c8f67f4 to your computer and use it in GitHub Desktop.
VueApollo Query
<template>
<div>
<h2>유저 리스트</h2>
<div v-for="user in users" :key="user.id">
{{ user.id }} {{ user.name }} {{ user.age }}
</div>
</div>
</template>
<script lang="ts">
import Vue from "vue";
import gql from "graphql-tag";
export default Vue.extend({
name: "UserList",
data() {
return {
users: [],
};
},
apollo: {
users: {
query: gql`
query users {
users {
id
name
age
}
}
`,
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment