Last active
June 3, 2021 04:19
-
-
Save chaeyeonhan1225/9a0e3a6fa81de6be262ccbdd9c8f67f4 to your computer and use it in GitHub Desktop.
VueApollo Query
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 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