mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
e7cc2757c3
Co-authored-by: Alexander Lichter <manniL@gmx.net>
35 lines
592 B
Vue
35 lines
592 B
Vue
<template>
|
|
<div class="player">
|
|
<h1>#{{ number }}</h1>
|
|
<h2>{{ name }}</h2>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
validate ({ params }) {
|
|
return !isNaN(+params.id)
|
|
},
|
|
asyncData ({ params, env, error }) {
|
|
const user = env.users.find(user => String(user.id) === params.id)
|
|
if (!user) {
|
|
return error({ message: 'User not found', statusCode: 404 })
|
|
}
|
|
return user
|
|
},
|
|
head () {
|
|
return {
|
|
title: this.name
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.player {
|
|
text-align: center;
|
|
margin-top: 100px;
|
|
font-family: sans-serif;
|
|
}
|
|
</style>
|