今天準(zhǔn)備用el-tabs寫個頁面,發(fā)現(xiàn)點擊后組件怎么都顯示不了,后來才發(fā)現(xiàn)是組件引用的原因
?這是頁面是顯示的效果:
?乍一看確實是對的。。。
但是當(dāng)我點擊完這三個tab后再重新點擊道路管理后,有意思的出現(xiàn)了:
?one組件消失不見了,不僅如此,另外兩個組件也不顯示了。。。
這里看見控制臺報了一個這樣的警告:
index.vue:34 [Vue warn]: Invalid vnode type when creating vnode: null.
at <ElTabPane label="道路管理" name="first" >
at <ElTabs modelValue="first" onUpdate:modelValue=fn class="demo-tabs" ... >
at <MyComponent>
at <MyComponent$1689578690715 onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object)?{$i18n: {…}, $t: ?, $rt: ?,?…} > key="/road_network/index" >
at <KeepAlive key=0 include= [] >
at <BaseTransition mode="out-in" appear=false persisted=false ... >
at <Transition name="fade-transform" mode="out-in" >
at <RouterView>
at <ElCard class="base-content-box-noFooter hasHeight" >
at <ElMain>
at <ElContainer class="zq-right-box" >
at <ElContainer style= {height: '100vh'} class="zq-app-content-box" >
at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< Proxy(Object)?{__v_skip: true} > >
at <RouterView>
at <ElConfigProvider locale= {name: 'zh-cn', el: Proxy(Object)} size="default" >
at <App>
網(wǎng)上查了一下是因為組件引用的時候要使用大駝峰命名
文章來源:http://www.zghlxwxcb.cn/news/detail-588155.html
?后來該、改完了之后,頁面就正常顯示了文章來源地址http://www.zghlxwxcb.cn/news/detail-588155.html
到了這里,關(guān)于vue3組件引用使用的坑的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!