我的路由器具有:
export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [{
path: '/',
name: 'login',
component: Login,
},
{
path: '/app',
component: Container,
children: [{
path: '',
name: 'home',
component: Home
}]
},
],
});
我的Container.vue
有:
<template>
<div>
<Navigation />
<router-view />
</div>
</template>
<script>
import Navigation from "./Navigation.vue";
export default {
name: "Container",
props: {
msg: String
}
};
</script>
但是我得到一个错误:
未知的自定义元素:-您是否正确注册了组件?对于递归组件,请确保提供“名称”选项。
位于
--->在src / components / Container.vue 在src / App.vue
我在Navigation.vue
中拥有
<template>
<nav class="nav nav-pills flex-column flex-sm-row">
<a class="flex-sm-fill text-sm-center nav-link active" href="#">Active</a>
<a class="flex-sm-fill text-sm-center nav-link" href="#">Longer nav link</a>
<a class="flex-sm-fill text-sm-center nav-link" href="#">Link</a>
<a
class="flex-sm-fill text-sm-center nav-link disabled"
href="#"
tabindex="-1"
aria-disabled="true"
>Disabled</a>
</nav>
</template>
<script>
export default {
name: "Navigation"
};
</script>
答案 0 :(得分:1)
您缺少在components:{Navigation}
组件中添加Container.vue
export default {
name: "Container",
props: {
msg: String
},
components:{Navigation}
};