2017-05-31 61 views
2

正在使用vuetify建立一個模板,但我得到一個錯誤Vuetifyjs錯誤未知的自定義元素:你註冊的組件正確

unknown custom element dashboard did you register the component correctly? 

這是我的代碼:

In the main.js 
import Vue from 'vue' 
import App from './App.vue' 
import Vuetify from 'vuetify' 
import VueRouter from 'vue-router'; 
import {routes} from './routes'; 

    Vue.use(VueRouter); 

    Vue.use(Vuetify) 

new Vue({ 
    el: '#app', 
    render: h => h(App) 
}) 

在我的應用程序。 VUE

<template> 
    <dashboard></dashboard> 

</template> 
<script> 
import Dashbaord from './components/dashboard/Dashboard.vue'; 
    export default { 
    name: "appinit", 
    components: { 
    "dashboard":Dashboard 
    } 
} 

這裏是我的儀表盤

<template> 
<v-app> 
    <left-drawer></left-drawer> 
    <toolbar></toolbar> <!-- Dashboard Toolbar--> 
    <main> 
     <v-container fluid> 
     ..info are 
     </v-slide-y-transition> 
     </v-container> 
    </main> 
    <right-drawer></right-drawer> 
    <footer-area></footer-area> 
</v-app> 
</template> 

    <script> 
    imports ...... 

export default { 
    components: { 
    Toolbar, RightDrawer,LeftDrawer,FooterArea 
    } 
} 

可能是錯的是什麼,因爲我剛纔分離初始vuefy安裝組件成不同的組件部分

的代碼可以在GitHub上的This link

出了什麼問題?

+0

我不知道你在哪裏註冊儀表板組件。查看他們的https://vuejs.org/v2/guide/components.html#Registration – C0d1ngJammer

+1

我已將註冊的儀表板作爲AppVue組件的本地組件,檢查組件:{} area –

+0

,如下所示:https: //vuejs.org/v2/guide/components.html#Local-Registration –

回答

3

您在代碼中幾乎沒有問題。

  1. 您必須關閉標籤在App.vue
  2. 修正錯字App.vue 6號線「儀表板」
  3. 從Dashboard.Vue刪除頁腳區域(你沒有這樣的組件,但; ))
+0

感謝它現在的作品 –