我配置 'i-tab-pane': Tabpane
但是报错,代码如下:
<template>
<div class="page-common">
<i-tabs>
<i-tab-pane label="wx">
content
</i-tab-pane>
</i-tabs>
</div>
</template>
<script>
import {
Tabs,
Tabpane
} from 'iview'
export default{
name:"data-center",
data(){
return {msg: 'hello vue'}
},
components: {
'i-tabs' : Tabs,
'i-tab-pane': Tabpane
}
}
</script>
错误回溯:
[Vue warn]: Unknown custom element: <i-tab-pane> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <DataCenter> at src/views/dc/data-center.vue
<Index> at src/views/index.vue
<App> at src/app.vue
我试过在 main.js
中进行全局配置:
Vue.component("Tabpane", Tabpane);
但还是不行。如何解决这个问题?
原文由 user7693832 发布,翻译遵循 CC BY-SA 4.0 许可协议
由于您为组件应用了不同的名称:
导出时您还需要具有相同的名称:(在您的 Tabpane 组件中检查名称)
从错误中,我可以说你没有在你的组件中定义
name
Tabpane
。确保验证name
它应该可以正常工作,没有错误。