【发布时间】: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 组件。
【问题讨论】: