S
S
Sodmev2019-07-12 17:57:25
Vue.js
Sodmev, 2019-07-12 17:57:25

How to fix error when importing parent component into child Vue.js?

Good time!
The essence of the problem is this:
What can cause the error Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option. when importing a parent comment <temp-component>into a child one with the following hierarchy:

<temp-component>
      <rowComponent>
            <colComponent>
                   и тут импортируется <temp-component></temp-component>
            </colComponent>
      </rowComponent>
</temp-component>

I remove the import <temp-component>in the child element, everything works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily, 2019-07-12
@VasilyBykov

Components must have the name property specified, in components of a child component, the name of the parent component must be the same as name.

D
Dmitry Barkowski, 2019-07-13
@TypeOFF

Perhaps the used component was specified incorrectly, or was not specified at all.

import TempComponent from './temp-component.vue'
export default {
  name: 'root-component-name',
  components: {
  TempComponent
  }
  etc...
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question