【问题标题】:[Vue warn]: Unknown custom element: <v-xxxxxx>[Vue 警告]:未知的自定义元素:<v-xxxxxx>
【发布时间】:2019-12-14 00:04:40
【问题描述】:

我目前在一个基于 Vuepress 构建的静态网站上工作。在 .md 文件中注册 Vue 组件时出现错误。

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

found in

---> <Page> at lib/default-theme/Page.vue
       <Layout> at lib/default-theme/Layout.vue
         <Root

组件挂载失败,Vue devtools中只显示组件树

<Page>
     <Content>

里面什么都没有。

如果我点击刷新,组件会正确呈现并且我有预期的结果:

<Page>
     <VXXXXXXX>
         <Component1>
         <Component2>


问题看起来与此处引用的内容相似:https://github.com/vuejs/vuepress/issues/1173 但我找不到可行的解决方案。

例如,我有一个/docs/contact/README.md,它看起来像:

---
title: a title
description: a description
pageClass: homepage subpage contact
headerText: Contact
blackSubText: some text
submitText: Envoyer
submitImage: /img/icons/green-arrow.png

---

<headerTextComponent/>

<formulaire type="contact" formId="/6db97999-f466-4250-aa47-bd6e96a6b520" :fields="['contactobject', 'message']"/>


<blog/>


我上面引用的自定义组件在/docs/.vuepress/components 中,都是带有 name 属性集的常规 Vue 组件。

【问题讨论】:

    标签: vue.js vuepress


    【解决方案1】:

    我刚刚遇到了类似的问题。然而,经过数小时的谷歌搜索和重建 VuePress,我尝试访问 http://127.0.0.1:8081 而不是 http://localhost:8081 - 它成功了!

    我认为这是一个缓存问题或类似的问题 - 即使没有安装服务工作者。

    【讨论】:

      猜你喜欢
      • 2018-02-06
      • 2017-12-22
      • 2020-03-28
      • 2018-01-08
      • 2019-09-22
      • 2019-07-07
      • 2021-01-01
      • 2018-04-08
      • 2020-01-02
      相关资源
      最近更新 更多