pages/
‐‐
| user/
‐‐‐‐‐
| index.vue
‐‐‐‐‐
| one.vue
router: {
routes: [
{
name:
'
user
'
,
path:
'
/user
'
,
component:
'
pages/user/index.vue
'
},
{
name:
'
user
‐
one
'
,
path:
'
/user/one
'
,
component:
'
pages/user/one.vue
'
}
]
}
<template>
<div>
用户管理首页
</div>
</template>
<script>
export default{
layout:
"
test
"
}
</script>
<style>
</style>
<template>
<div>
one页面
</div>
</template>
<script>
export default{
layout:
"
test
"
}
</script>
<style>
</style>
pages/
‐‐
| user/
‐‐‐‐‐
| _id.vue
‐‐‐‐‐
| index.vue
‐‐
| user.vue
router: {
routes: [
{
path:
'
/user
'
,
component:
'
pages/user.vue
'
,
children: [
{
path:
''
,
component:
'
pages/user/index.vue
'
,
name:
'
user
'
},
{
path:
'
:id
'
,
component:
'
pages/user/_id.vue
'
,
name:
'
user
‐
id
'
}
]
}
]
}
<template>
<div>
用户管理导航,<nuxt
‐
link :to
=
"'
/user/101
'"
>修改</nuxt
‐
link>
<nuxt
‐
child/>
</div>
</template>
<script>
export default{
layout:
"
test
"
}
</script>
<style>
</style>
<template>
<div>
修改用户信息{{id}}
</div>
</template>
<script>
export default{
layout:
"
test
"
,
data(){
return {
id:
''
}
},
mounted(){
this.id
=
this.
$route.
params.id;
console.log(this.id)
}
}
</script>
<style>
</style>
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |