ERROR Failed to compile with 1 error 14:21:34

error in ./src/router/index.js

Module not found: Error: Can't resolve '../views/AboutView.vue' in 'C:\Users\24210\Desktop\houtai\src\router'

ERROR in ./src/router/index.js 35:11-37:29
Module not found: Error: Can't resolve '../views/AboutView.vue' in 'C:\Users\24210\Desktop\houtai\src\router'
 @ ./src/main.js 37:0-30 52:10-16

webpack compiled with 1 error

解决方法

这个错误是没有定义AboutView组件导致的,我出现这个错误是因为把这个组件删除后,没有删除相对应的引用。删除路由index.js下的引用即可解决问题

import Vue from 'vue'

import VueRouter from 'vue-router'

// import Main from '../views/Main.vue'

Vue.use(VueRouter)

const routes = [

  {

    path: '/',

    name: 'Main',

    component: ()=>import('../views/Main.vue'),

    children:[

      {

        path:'/home',

        name:'home',

        component:()=>import('../views/home')

      },

      {

        path:'/user',

        name:'user',

        component:()=>import('../views/User')

      },

    ]

  },

]

const router = new VueRouter({

  mode: 'history',

  base: process.env.BASE_URL,

  routes

})

export default router

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐