[Vue警告]:未知的自定义元素

时间:2017-08-29 02:17:27

标签: javascript laravel vue.js vuejs2 vue-router

我是vuejs的新手,在laravel框架中编写一个js代码时,我收到错误:

[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
})

请建议做什么?

1 个答案:

答案 0 :(得分: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'