ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
#### <font color=red /> 2,Runtime-Compiler和Runtime-only的区别 [参考博客1](https://segmentfault.com/a/1190000020253015) [参考博客2](https://www.cnblogs.com/jjbw/p/12129771.html) ```javascript // Runtime+Compiler版本 new Vue({ el: '#app', components: { App }, template: '<App/>' }) // Runtime-only版本 set in webpack.base.conf with an alias. new Vue({ el: '#app', render: h => h(App) }) ``` * `runtime-compiler(v1)`(运行过程)): template -> ast -> render -> vdom -> UI * `runtime-only`(v2 1.性能更高, 2.代码量更少):render -> vdom -> UI runtime-only:将template在打包的时候,就已经编译为render函数 runtime-compiler:在运行的时候才去编译template 发布生产的时候,runtime-only构建的项目代码体积更小,运行速度更快 推荐使用runtime-only函数 * 如果在开发中,依然使用template,就需要选择Runtime-Compiler * 如果在开发中,使用的是.vue文件夹开发,那么可以选择Runtime-Only