vue初始化报错,Cannot read property '$createElement' of undefined

使用vue-router,在main.js中import组件,初始化后报错:
Failed to resolve async component render: TypeError: Cannot read property '$createElement' of undefined

这是main.js代码:
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import goods from './components/goods.vue'
import ratings from './components/ratings.vue'
import seller from './components/seller.vue'
Vue.use(VueRouter)
Vue.config.productionTip = false
/ eslint-disable no-new /
var routes = [
{path: '/goods', components: goods},
{path: '/ratings', components: ratings},
{path: '/seller', components: seller}
]
var router = new VueRouter({
routes
})
new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
})

阅读 9k
评论 2017-10-04 提问
    1 个回答

    var routes = [
    {path: '/goods', components: goods},
    {path: '/ratings', components: ratings},
    {path: '/seller', components: seller}
    ]
    把components改成component,不加s

    评论 赞赏