[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available
2018-07-04 23:57
851 查看
版权声明:本文为博主原创文章,转载请注明原创链接,感谢支持!(如文章有侵权,请联系作者删除) https://blog.csdn.net/qq_35324453/article/details/80920344
相信很多初学者使用vue-cli2.x初始化脚手架项目的时候或者webpack配置的时候会遇到这个问题:
一开始初始化项目配置的时候,有两个运行环境配置的版本:Compiler版本、Runtime版本。
简单说一下这两个版本的区别:
当对template模板内容编译是需要对字符串进行模板渲染或者可以绑定的html对象作为模板进行渲染的方式,就需要使用Compiler版本。示例如下:
new Vue({ el:'#vue-app', template:'<div><h1>{{test}}</h1></div>', data:{ test:'hello' } });
如果使用vue-loader加载.vue文件时(组件文件),webpack在打包对模板进行了渲染,就需要Runtime版本。示例如下:
new Vue({ el: '#app', components: { App }, template: '<App/>' })
从Compiler版本修改为Runtime版本。只需如示代码:
添加一行代码:
'vue$': 'vue/dist/vue.esm.js',,然后重新运行编译就可以了 阅读更多
相关文章推荐
- You are using the runtime-only build of Vue where the template compiler is not available. Either pre
- webpack打包vue2.0,[Vue warn]: You are using the runtime-only build of Vue where the template compiler
- [Vue warn]: You are using the runtime-only build of Vue where the templa
- Can't create a new thread (errno 11); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug
- Mongodb无法启动:The default storage engine 'wiredTiger' is not available with this build of mongod.
- INS-35354] The system on which you are attempting to install Oracle RAC is not part of a valid clust
- fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module
- You are using version 6.4.1 of the AdMob SDK which is non-compliant with the Google Play Ad Policy
- 解决You are using pip version 9.0.1, however version 9.0.3 is available. You should consider upgrading
- Android: You are not using bash - builds will fail
- the resource is not on the build path of a java project错误
- vue父子组件嵌套的时候遇到 - Component template should contain exactly one root element. If you are using v-i
- NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.
- The authenticity of host 'www.101du.net (60.210.17.34)' can't be established. RSA key fingerprint is xxxx. Are you sure you want
- 解决You are using pip version 8.1.1, however version 9.0.1 is available. You should consider upgrading
- The control is not available because you do not have the correct permissions
- The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the
- Which statement is true about loading data using the conventional path of SQL*Loader? A.Redo is not
- "Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased."
- This view is not constrained vertically: at runtime it will jump to the left unless you add a vertic