[英]Vuejs import component in another component
我创建了一个dashboard.vue 组件并将table.vue 组件导入其中,但是table.vue 没有出现在我的web 页面和vue.dev 工具中。
当我在 app.vue 中导入 table.vue 时没有问题。
在我的文件下面。
提前致谢!
//dashboard.vue
<template>
<div>
<table></table>
</div>
</template>
<script>
import table from "./table";
export default {
name: 'Dashboard',
component: {
table,
}
}
</script>
<style >
</style>
//table.vue
<template>
<div>
<p>Test</p>
</div>
</template>
<script>
export default {
name: 'Table',
}
</script>
您不能将组件命名为与保留的 HTML 元素相同的名称。 将其更改为my-table
。
你需要 map 它:
component: {
'my-table': table,
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.