Nuxt3嵌套路由,報錯Failed?to?resolve?component:?NuxtChild的解決
問題報錯
[Vue warn]: Failed to resolve component: NuxtChild If this is a native
custom element, make sure to exclude it from component resolution via
compilerOptions.isCustomElement.

運行的時候控制臺報錯,子組件child.vue中的內(nèi)容也顯示不了。
文件目錄

代碼
app.vue中的代碼
<template>
<div>
<!-- 顯示pages中index.vue的內(nèi)容 -->
<NuxtPage></NuxtPage>
</div>
</template>index.vue中的代碼
<template>
<div>
<!-- 路由跳轉(zhuǎn)到parent下面的child -->
<NuxtLink to="/parent/child">跳轉(zhuǎn)</NuxtLink>
</div>
</template>parent.vue中的代碼
<template>
<div>
這是父組件內(nèi)容
<NuxtChild></NuxtChild>
</div>
</template>child.vue中的代碼
<template>
<div>這是子組件內(nèi)容</div>
</template>解決方案
把parent.vue中的<NuxtChild></NuxtChild>改成<NuxtPage></NuxtPage>就可以正常顯示了,改完后控制臺不報錯了,child.vue子組件的內(nèi)容也能正常顯示了

總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
vue-router配合ElementUI實現(xiàn)導(dǎo)航的實例
下面小編就為大家分享一篇vue-router配合ElementUI實現(xiàn)導(dǎo)航的實例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-02-02
electron-vue?項目添加啟動loading動畫的實現(xiàn)思路
electron-vue腳手架搭建的項目,在開發(fā)階段可能你注意不到項目啟動慢的問題,但是在build?生成的exe可執(zhí)行文件,啟動后,要反應(yīng)很久才能進入到app.vue?中加載的頁面,體驗性很差,本文給大家介紹electron?vue啟動動畫效果的實例代碼,感興趣的朋友一起看看吧2022-01-01

