VUE报错You are using the runtime-only build of Vue where the template compiler is not available

问题背景

今天在入门vue-route但是发现怎么处理都有以下报错,并且参考了网上大多数解决方法都不行,最后找到一个最终的解决方法,这才搞定,但愿可以帮到每个路过的入门者。

报错信息

[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

翻译一下就是您正在使用Vue的仅运行时版本,并而模板编译器不可用。 可以将模板预编译为渲染函数,也可以使用包含编译器的内部版本。。。。一脸懵逼有没有???小朋友表示有太多的问号。
在这里插入图片描述

解决方案

在vue项目下新建一个vue.config.js
在这里插入图片描述
文件内容为

module.exports = {
  //Solution For Issue:You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
  //zhengkai.blog.csdn.net
  runtimeCompiler: true
}

开源项目

学习Vue(待上线)
http://github.com/moshowgame/vue-study

猜你喜欢

转载自blog.csdn.net/moshowgame/article/details/107182655