I use vite+typescript+pinia to develop the vue3 project, because I have just come into contact with this problem recently. Look at the code first:
<script lang="ts" setup name="XtxMore">
</script>
<template>
<RouterLink
to="/"
class="xtx-more"
>
<span>
<slot>Check All</slot>
</span>
<i class="iconfont icon-angle-right"></i>
</RouterLink>
</template>
At this time, an error will be reported in the console:
This is because when we name the component, that is, when we add the name attribute to the component, there is no content in the script tag, which will lead to the failure of parsing and the error will be reported.
Just add something in the script tag
<script lang="ts" setup name="XtxMore">
defineProps()
</script>
<template>
<RouterLink class="xtx-more">
<span>
<slot>Check All</slot>
</span>
<i class="iconfont icon-angle-right"></i>
</RouterLink>
</template>
Read More:
- Vue3.0 error: Failed to resolve component el-form-item (el element to be unable to be displayed)
- [Solved] vue3vite Error: Failed to resolve import “@vue/server-renderer from “src\App.vue“. Does the file exist
- Failed to resolve async component default: ChunkLoadError: Loading chunk 7 failed
- [Solved] error Component name “xxx“ should always be multi-word vue/multi-word-comp
- [Vue warn]: Failed to resolve directive: XXX [How to Solve]
- [Solved] Vue3.2 component computed Error: Write operation failed: computed value is readonly
- [Solved] Vue Error: Failed to resolve directive: scroll-to
- [Solved] Vue2.x vue-lazyload Error: Failed to resolve directive: lazy
- Vue warn]: vue3 element Component emit Pass Event Error
- [Solved] Vue3.0 Error: The component has been registered but not used vue/no-unused-components, Close eslint
- [Solved] vue error: error Component name “School“ should always be multi-word vue/multi-word-component-names
- Vue element component V-for error [How to Modify)
- 9:13 error Component name “home“ should always be multi-word vue/multi-word-component-names
- Vue Import element-plus Error: Failed to resolve import “element-pluslibtheme-chalkindex.css“ from “src
- [Solved] Vue eslint Error: Component name “*****“ should always be multi-word
- Vue Error: component has been registered but not used [Two Methods to Solve]
- Vue: How to Solve error avoided redundant navigation to current location: “/xxx”
- Vue elementui: solution for error: avoided redundant navigation to current location: “/xxx”
- [Solved] Yapi Secondary deploy error: xxx validation failed: mock: Path `xxx` is required
- [Solved] ERROR in ./src/main.ts Module not found: Error: Can‘t resolve ‘xxx‘