在公司下班前提交的代码,夜晚回家pull一把,运行却报错:

Failed to mount component: template or render function not defined.

百度翻译:无法安装组件:模板或渲染功能未定义。

什么原因呢?百度了一大圈,有的说需要修改配置文件,有的说需要回退vue-loader版本。。。。。

但是都试了个遍,报错还是存在;

于是我在回想最近的一次可能导致报错的操作就是将vue文件中js和css都抽离出来了,难不成是路由引用的路径问题?

Failed to mount component: template or render function not defined.

 

 于是我将上面的路径修改为如下:

 

  Failed to mount component: template or render function not defined.

 

 没错,就是后面加上.vue

果然报错消失!

原来将js和css抽离出来后,为了省事,名字都叫的是index.js和index.scss,导致路由在引入路径的时候,不知道到底要引入那个index.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
相关资源
相似解决方案