我用vue-cli构建了一个项目,只有在app.vue里调用组件时就报错,但在子页面当中却能正常调用,到底是什么原因?
下面是错误报告:
ERROR in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
Module not found: Error: Can't resolve 'components/navList.vue' in 'C:UsersMr.Mooneappptsrc'
@ ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue 3:0-45
@ ./src/App.vue
@ ./src/main.js
@ multi ./build/dev-client ./src/main.js
另外我在npm终端看到这个错误提示:
This dependency was not found:
* components/navList.vue in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
To install it, you can run: npm install --save components/navList.vue
这是app.vue的部分代码:
<script>
import navList from 'components/navList.vue'
export default {
name: 'app',
data:function(){
return {
items:[
{text:'asd',href:'#'}
]
}
},
components:{
'nav-list':navList
}
}
</script>