Created
June 3, 2021 04:50
-
-
Save chaeyeonhan1225/6df84074ded22141a6baa74d5dd8ce8c to your computer and use it in GitHub Desktop.
ApolloQuery
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> | |
| <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