mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 17:37:14 +00:00
27 lines
484 B
Vue
27 lines
484 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 {
|
||
|
async fetch () {
|
||
|
const url = (process.server ? `http://${this.$ssrContext.req.headers.host}` : '')
|
||
|
|
||
|
this.team = await fetch(`${url}/team.json`).then(res => res.json())
|
||
|
},
|
||
|
data () {
|
||
|
return {
|
||
|
team: []
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
</script>
|