vue-router TypeError: Cannot read property ‘$createElement‘ of undefined

vue-router TypeError: Cannot read property ‘$createElement‘ of undefined

在这里插入图片描述

路由不跳转,还报错,router 文件夹下的 index.js 代码如下:

错误的原因是把 component 写成了 components

import Vue from 'vue'
import VueRouter from 'vue-router'

import Content from '../components/Content'
import Main from '../components/Main'

//安装路由
Vue.use(VueRouter);

//配置导出路由
export default new VueRouter({
  routes:[
    {
      //路由路径
      path: '/content',
      name: 'content',
      //跳转的组件
      component: Content
    },
    {
      //路由路径
      path: '/main',
      name: 'main',
      //跳转的组件
      component: Main
    }
  ]
});

Guess you like

Origin blog.csdn.net/m0_59133441/article/details/120987549