您是否正确注册了组件?对于递归组件,请确保提供“名称”选项

我配置了'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);

但仍然无法正常工作。如何解决这个问题?

米亚猴子2020/03/11 17:26:43

添加我的场景。以防万一有人遇到类似问题并且无法识别实际问题。

我正在使用Vue Splitpanes

以前,它仅需要“ Splitpanes”,在最新版本中,他们制作了另一个“ Pane”组件(作为splitpanes的子代)。

现在的事情是,如果您没有在最新版的分割窗格中注册“ Pane”组件,则显示“ Splitpanes”错误。如下。

[Vue warn]: Unknown custom element: <splitpanes> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
路易Gil2020/03/11 17:26:43

我也有这个错误。我三重检查了名字是否正确。

但是,我得到此错误的原因仅仅是因为我没有终止script标签。

<template>
  <div>
    <p>My Form</p>
    <PageA></PageA>        
  </div>
</template>

<script>
import PageA from "./PageA.vue"

export default {
  name: "MyForm",
  components: {
    PageA
  }
}

请注意,结尾没有</ script>

因此,请务必仔细检查。

老丝GO2020/03/11 17:26:43

确保注意以下事项:

  1. 您的进口声明及其路径,

  2. 您在组件{....}块中输入的组件TagName,

  3. 您的块名称应为小写的组件。

希望它能解决问题。