vue:Runtime-only和Runtime-compiler的区别
主要的区别在main.js
Runtime-compiler的main.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>'
})
解释:template-ast(抽象语法树)-reder函数-virtual dom-真实的dom
Runtime-only的main.js
import Vue from 'vue'
import App from './App'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
render: h => h(App)
})
解释:reder函数->virtual dom ->UI
优点:
1.性能更多.
2.代码量少
相对实际开发中用这个.