情景



關鍵
- 組件沒有正確引入
- 函式無限遞回
解決
如果在網上搜索[Vue warn]: Component is missing template or render function. 或[Vue warn]: Invalid vnode type when creating vnode: null. .
可能會找到關于組件沒有正確引入的解決方法,主要是:
- 引入組件的時候,組件的路徑結尾的
.vue不要省略, - 引入組件的時候,要使用規范的駝峰命名法,
我使用的是vite,似憾訓自動引入組件,即不需要寫import ComponentName from '@/components/...;'
我檢查之后,發現是:
我為了獲取組件的DOM節點,使用了ref,但是組件上的ref和組件名重復了:
<MyComponent ref="myComponent"/>
這樣似乎是會影響到vue的組件管理,于是導致了錯誤,
我將ref改為myComponentRef之后就可以正常運行了,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/546873.html
標籤:其他
