Discard changes to playground/app.vue

This commit is contained in:
Alexander Lichter 2024-02-18 17:19:11 +01:00 committed by GitHub
parent 6136b3e219
commit dd91a038ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,31 +1,13 @@
<script setup>
const page = ref(0)
const nuxt = useNuxtApp()
const { data, refresh } = await useFetch('https://icanhazdadjoke.com/', {
query: { page }, // "fed" into watch array for asyncData under the hood
getCachedData: (key) => {
return nuxt.payload.data[key] || nuxt.static.data[key]
},
headers: {
Accept: 'application/json',
},
})
<script setup lang="ts">
</script>
<template>
<!-- Edit this file to play around with Nuxt but never commit changes! -->
<div>
<button @click="refresh()">
New Joke (refresh, default)
</button>
<button @click="refresh({ force: true })">
New Joke (refresh, force)
</button>
<button @click="page++">
New Joke (update query value + 1)
</button>
<button @click="page--">
New Joke (update query value - 1)
</button>
{{ data.joke }}
Nuxt 3 Playground
</div>
</template>
<style scoped>
</style>