﹝Jotting﹞ - Nuxt.js Posted on 2018-01-08 | Post modified 2019-04-22 做個筆記怕忘記 嵌套路由 - 2018 / 01 / 08資料結構12345pages/--| users/-----| _id.vue-----| index.vue--| users.vue users.vue123456789<template> <section class="container"> <div> {{message}} <hr> <nuxt-child/> </div> </section></template> users/_id.vue12345678910111213141516<script>export default { validate ({ params }) { // Must be a number //判斷是否為數字 return /^\d+$/.test(params.id) }, asyncData ({ params, env, error }) { const user = {message: params.id} // if (!user) { // return error({ message: 'User not found', statusCode: 404 }) // } return user }}</script> Note父層Vue文件內增加用於顯示子視圖內容。params.id取得值 Ref. 嵌套路由 nuxt-child