Nuxt/examples/nested-routes/pages/index/_id.vue
Jonas Galvez 3f1d634fb7 Consistent parens in arrow functions (#3630)
* Minor consistency enhancements

* Arrow parenthesis consistency

* Change linting rule

* Fix typo

* Update .eslintrc.js to only require parens for blocks

* Update style according to brace-only suggestion

* Remove --fix from lint

* Tweak no-loading time (failing test)

* Tweak no-loading time (failing test) (2)

* Tweak no-loading time (failing test) (3)

* Tweak no-loading time (failing test) (4)

* Tweak no-loading time (failing test) (5)
2018-08-06 02:12:44 +02:00

35 lines
589 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>