vue組件引用另一個組件出現組件不顯示的問題


下載的一個vue構建的后台管理系統,導航欄是一個側邊欄,想在頭部里面加一個導航

先是導入要使用的組件

import Hamburger from '@/components/Hamburger'
import Nav from '@/components/Nav/index.vue' //自己新建的

然后在 components 里面寫入該組件

components: {
    Hamburger,
    Nav  //自己定義的
  }

最后在模板 tamplete 中使用

<template>  
  <div class="navbar">
    <breadcrumb class="breadcrumb-container" />
    <nav /> 
  </div>  
</template> 

但是在檢查頁面的時候發現 頁面里面並沒有顯示 Nav/index.vue 里面的內容

然后在cmd上面發現報錯,說Nav已定義 未使用

Module Warning (from ./node_modules/eslint-loader/index.js):
error: The "Nav" component has been registered but not used (vue/no-unused-components) at src\layout\components\Navbar.vue:44:5:
  43 |     Hamburger,
> 44 |     Nav
     |     ^
  45 |   },

又試了半天也不知問題出在哪里,然后想着首字母大寫有沒有,就試了一下,發現居然顯示了

但是其他的組件都是小寫的就可以,不知道為什么


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM