-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add basic support for vue options api (#575)
- Loading branch information
Showing
6 changed files
with
91 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,3 @@ | ||
<template> | ||
<div id="wrapper" bg-light text-dark> | ||
<main p-4> | ||
<div flex flex-col gap-4> | ||
<NCard class="p4"> | ||
<div class="n-header-upper"> | ||
GraphQL API | ||
</div> | ||
|
||
<form class="flex gap-3 items-center"> | ||
<NRadio | ||
v-for="entry of apis" | ||
:key="entry" | ||
v-model="api" | ||
:name="entry" | ||
:value="entry" | ||
n="red6 dark:red5" | ||
> | ||
{{ entry }} | ||
</NRadio> | ||
</form> | ||
</NCard> | ||
|
||
<template v-if="api === 'github'"> | ||
<GithubDemo /> | ||
</template> | ||
<template v-else-if="api === 'starlink'"> | ||
<StarlinkDemo /> | ||
</template> | ||
<template v-else-if="api === 'todos'"> | ||
<TodosDemo /> | ||
</template> | ||
</div> | ||
</main> | ||
|
||
<footer border-t-1 border-slate flex justify-center items-center> | ||
@nuxtjs/apollo playground | ||
</footer> | ||
</div> | ||
<NuxtPage /> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
const apis = ref(['starlink', 'todos', 'github']) | ||
const apiCookie = useCookie('apollo_api', { default: () => apis.value[0] }) | ||
const api = ref(apiCookie.value) | ||
watch(api, value => (apiCookie.value = value)) | ||
</script> | ||
|
||
<style scoped> | ||
#wrapper { | ||
min-height: 100vh; | ||
display: grid; | ||
grid-template-rows: 1fr 60px; | ||
} | ||
</style> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script lang="ts" setup> | ||
const apis = ref(['starlink', 'todos', 'github']) | ||
const apiCookie = useCookie('apollo_api', { default: () => apis.value[0] }) | ||
const api = ref(apiCookie.value) | ||
watch(api, value => (apiCookie.value = value)) | ||
</script> | ||
|
||
<template> | ||
<div id="wrapper" bg-light text-dark> | ||
<main p-4> | ||
<div flex flex-col gap-4> | ||
<NCard class="p4"> | ||
<div class="n-header-upper"> | ||
GraphQL API | ||
</div> | ||
|
||
<form class="flex gap-3 items-center"> | ||
<NRadio | ||
v-for="entry of apis" | ||
:key="entry" | ||
v-model="api" | ||
:name="entry" | ||
:value="entry" | ||
n="red6 dark:red5" | ||
> | ||
{{ entry }} | ||
</NRadio> | ||
</form> | ||
</NCard> | ||
|
||
<template v-if="api === 'github'"> | ||
<GithubDemo /> | ||
</template> | ||
<template v-else-if="api === 'starlink'"> | ||
<StarlinkDemo /> | ||
</template> | ||
<template v-else-if="api === 'todos'"> | ||
<TodosDemo /> | ||
</template> | ||
</div> | ||
</main> | ||
|
||
<footer border-t-1 border-slate flex justify-center items-center> | ||
@nuxtjs/apollo playground | ||
</footer> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
#wrapper { | ||
min-height: 100vh; | ||
display: grid; | ||
grid-template-rows: 1fr 60px; | ||
} | ||
</style> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
export default { | ||
apollo: { | ||
ships: { | ||
query: gql`query ships ($limit: Int = 10) { ships(limit: $limit) { id name } }`, | ||
variables: () => ({ limit: 3 }) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<pre> | ||
{{ ships }} | ||
</pre> | ||
</template> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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