我是一名新生,当我使用自定义组件时,它给了我这个错误:
Vue warn: Unknown custom element: - 您是否正确注册了组件?
ModalBase组件中使用的组件和NoticeModal.vue中 NoticeModal使用的组件productInfo.vue。
我确信我已正确导入NoticeModal并productInfo.vue导入ModalBase.vue,NoticeModal.vue并且全部注册。
但我得到唯一的警告:Unknown custom element: <modal-base>
这是ModalBase.vue:
<template>
<div>
<div class="modal-header">
<slot name="header">
<p class="title">This is base</p>
</slot>
</div>
</div>
</template>
<script>
export default {
name: "ModalBase",
data() {
return {show: ''}
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是NoticeModal.vue:
<template>
<div class="noticeModal">
<modal-base>
<div slot="header">hello</div>
</modal-base>
</div>
</template>
<script>
import {ModalBase} from '@/components/index';
export default …Run Code Online (Sandbox Code Playgroud)