mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-11 14:57:15 +00:00
92018e586b
[release]
28 lines
504 B
Vue
28 lines
504 B
Vue
<template>
|
|
<div>
|
|
<p v-if="$fetchState.pending">
|
|
Fetching...
|
|
</p>
|
|
<p v-else-if="$fetchState.error">
|
|
{{ $fetchState.error }}
|
|
</p>
|
|
<pre v-else>{{ team }}</pre>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
fetchKey: 'team',
|
|
data () {
|
|
return {
|
|
team: []
|
|
}
|
|
},
|
|
async fetch () {
|
|
const url = (process.server ? `http://${this.$ssrContext.req.headers.host}` : '')
|
|
|
|
this.team = await fetch(`${url}/team.json`).then(res => res.json())
|
|
}
|
|
}
|
|
</script>
|