2017-08-29 145 views
-1

我是新來vuejs,一邊寫laravel框架內的一個js代碼,我得到錯誤:[Vue公司提醒]:未知的自定義元素

[Vue warn]: Unknown custom element: <app> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

App.js

import Vue from 'vue' 
import Vcinfo from './Vcinfo.vue' 
import router from './router' 

const app = new Vue({ 
    el: '#vcinfo', 
    components: { Vcinfo }, 
    template: '<app></app>', 
    router 
}) 

請建議做什麼?

+3

你的模板中包含'',但你不導入一個名爲'app'組件。 – Bert

回答

0

這是給未來的讀者。 我犯了這個錯誤,我不得不這樣使用它。

import Vue from 'vue' 
import Vcinfo from './Vcinfo.vue' 
import router from './router' 

const app = new Vue({ 
    el: '#vcinfo', 
    components: { Vcinfo }, 
    template: '<vcinfo></vcinfo>', 
    router 
}) 

按本進口import Vcinfo from './Vcinfo.vue'