Module not found: Error: Can‘t resolve ‘..viewsAboutView.vue‘ in ‘C:Users24210Desktophout

Module not found: Error: Can‘t resolve ‘..viewsAboutView.vue‘ in ‘C:Users24210Desktophout,第1张

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

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1322442.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-12
下一篇 2022-06-12

发表评论

登录后才能评论

评论列表(0条)

保存