1、在配置路由并引入组件后,报错:
Unknown custom element: <router-link> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
错误原因:vue-router没有注册
解决办法:
//注册插件 *****************非常重要,不能忘记
Vue.use(VueRouter)
2、在组件中的标签和样式中图片路径出错时:报错:
Errors while compiling. Reload prevented.
Module not found: Error: Can't resolve './src/assets/img/btn_bg.png' in 'E:myStudyvue案例chexian-spasrccomponents'
解决办法:将图片的路径重新书写
3、在组件中标签没有闭合,报错:
Errors while compiling. Reload prevented.
./node_modules/_vue-loader@13.4.0@vue-loader/lib/template-compiler?{"id":"data-v-00822b28","hasScoped":false,"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.4.0@vue-loader/lib/selector.js?type=template&index=0&bustCache!./src/components/BaseProject.vue
(Emitted value instead of an instance of Error)
解决办法:检查html代码
4、在使用less定义变量是报错:
错误原因:必须用分号结尾:@imgUrl:'../../assets/img/';