vue.runtime.esm.js?ff9b:619 [Vue warn]: You are using the runtime-only build of Vue where the templa

vue错误提示:

vue.runtime.esm.js?ff9b:619 [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.

(found in < Root >)

在这里插入图片描述
这个错误耽误了博主好多时间呀~看了很多其他的答案也都没有用

根据错误提示说明,和搜索之后得出结论:是项目引入的vue编译版本不对

解决方法:
打开src/main.js修改Vue对象初始化。

修改前:

new Vue({
 el: '#app',
 router,
 components: { App },
 template: '<App/>'
})

修改后:

new Vue({
 el: '#app',
 router,
 render: h => h(App)
})

原因是,使用 template属性,需要引入带编译器的完整版的vue.esm.js

这样就解决好啦~

我是与其终,一个风起云涌的女孩子。
以下是我的公众号,主要写的是有关于前段后台数据库,面试技巧,学习方法,职场心得等,感兴趣的可以关注一下哦。
在这里插入图片描述
很高兴你能看到我的博客,希望能对你有所帮助。
qq群:可直接扫码进qq群,或者输入群号670983672。
微信群:可加下方博主微信,备注“进群”即可。
在这里插入图片描述
在这里插入图片描述