Unknown custom element - did you register the component correctly?

I am currently using webpack with vuejs 2. I have a very simple [Main.vue] component that is rendered by vue-router and inside this component I want to have another [Information.vue]. For some reason, I can't seem to get it right.

components / test / Information.vue

<template>
    <div>
    TEST
    </div>
</template>

<script>
export default {
  name: 'information',
  props: {
    bleh: {
      type: Object,
      required: true
    }
  }
}
</script>

      

components / test / injex.js

export { default as Main } from './Main'
export { default as Information } from './Information'

      

components / test / Main.vue

<template>
    <information :bleh="{}" />
</template>

<script>
import { Information } from 'components/test'
export default {
  name: 'main',
  components: { Information  }
}
</script>

      

Any idea why I am getting the following error?

[Vue warn]: Unknown custom element: <information> - did you register
the component correctly? For recursive components, make sure to
provide the "name" option

      

+4


source to share


1 answer


This is a really old question, but it answers so future visitors can get help:

The custom element must not be closed:

<information :bleh="{}" />

      

Make sure to use this:

<information :bleh="{}"></information>

      



Thanks to @connexo for the comment:

Also to match the official web components make sure you use the dotted tag like <information-component ...></information-component>

For anyone getting an error with the following:

Have you registered the component correctly?

Make sure to apply the name parameter in your component

0


source







All Articles