Skip to content

Instantly share code, notes, and snippets.

@chaeyeonhan1225
Created June 3, 2021 04:50
Show Gist options
  • Select an option

  • Save chaeyeonhan1225/6df84074ded22141a6baa74d5dd8ce8c to your computer and use it in GitHub Desktop.

Select an option

Save chaeyeonhan1225/6df84074ded22141a6baa74d5dd8ce8c to your computer and use it in GitHub Desktop.
ApolloQuery
<template>
<div>
<h2>유저 리스트</h2>
<div v-for="user in userList" :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 {
userList: [],
};
},
apollo: {
userList: {
query: gql`
query users {
users {
id
name
age
}
}
`,
update: (data) => data.users,
},
},
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment