vue中runtimecompiler和runtimeonly的区别
簡單總結
如果在之后的開發中,你依然使用template,就需要選擇runtimecompiler
如果你之后的開發中,使用的是.vue文件夾開發,那么可以選擇runtimeonly
runtimecompiler
Vue中的模板如何最終渲染成真實DOM
template -> ast -> render -> vdom -> UI
runtimeonly
Vue中的模板如何最終渲染成真實DOM
render -> vdom -> UI
性能更高
代碼量更少
那么.vue文件中的template是由誰處理的
是由vue-template-compiler
runtime-only 更快的原因:
runtime-only比runtime-compiler更快,因為它省略了vue內部過程中的第一個過程,如果是runtime-compiler那么main.js中就會出現template從而需要過程一導致增加了一個過程,同時增加了大小而 runtime-only 模式中不是沒有寫 template ,只是把 template 放在了.vue 的文件中了并有一個叫 vue-template-compiler的在開發依賴時將.vue文件中的 template 解析成 render 函數了因為是開發依賴,不在最后生產中,所以最后生產出來的運行的代碼沒有template
總結
以上是生活随笔為你收集整理的vue中runtimecompiler和runtimeonly的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 机房收费系统之退卡
- 下一篇: 解读《Superhuman AI for