美文网首页
报错Unknown custom element: <组件名>

报错Unknown custom element: <组件名>

作者: 喜欢走弯路的人 | 来源:发表于2023-09-13 16:43 被阅读0次

组件循环嵌套引用时会报错:Unknown custom element: <组件名> - did you register the component correctly?

解决办法:

beforeCreate() {

  this.$options.components.组件名称 = require('组件引用地址').default

}

例如:

html:

<MenuData ref="MenuData" :canvas="canvas" :flag="false" />

JS:

  beforeCreate () {

    this.$options.components.MenuData = require('./components/MenuData').default 

  },

相关文章

网友评论

      本文标题:报错Unknown custom element: <组件名>

      本文链接:https://www.haomeiwen.com/subject/bcepvdtx.html