【发布时间】:2021-07-17 19:14:47
【问题描述】:
我有一个简单的文件设置:
页面结构:
./pages/index.vue // root page to be displayed for '/'
./pages/child.vue // sub-page to be displayed inside index.vue for '/child'
index.vue:
<template>
<div>
<p>This is parent</p>
<some-component-from-components></some-component-from-components>
<nuxt-child />
</div>
</template>
child.vue:
<template>
<div>
<p>This is Child</p>
</div>
</template>
我希望'/' 路由将显示index.vue,而'/child' 路由index.vue 将在<nuxt-child /> 占位符中嵌入child.vue。 '/' 路由按预期工作,但 '/child' 仅显示 child.vue。
为什么? <nuxt-child /> 不能用于根页面还是有其他问题?
【问题讨论】:
标签: nuxt.js