Module not found: Error: Can‘t resolve ‘../views/AboutView.vue‘ in ‘C:\Users\24210\Desktop\hout
ERROR Failed to compile with 1 error 14:21:34error in ./src/router/index.jsModule not found: Error: Can't resolve '../views/AboutView.vue' in 'C:\Users\24210\Desktop\houtai\src\router'ERROR in ./src/r
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
更多推荐
所有评论(0)