编译器负责将模板字符串编译成 JavaScript 渲染函数。
例如,下面的代码片段显示了需要编译器和不需要编译器的模板的区别,
// this requires the compiler
new Vue({
template: '<div>{
{ message }}</div>'
})
// this does not
new Vue({
render (h) {
return h('div', this.message)
}
})
编译器负责将模板字符串编译成 JavaScript 渲染函数。
例如,下面的代码片段显示了需要编译器和不需要编译器的模板的区别,
// this requires the compiler
new Vue({
template: '<div>{
{ message }}</div>'
})
// this does not
new Vue({
render (h) {
return h('div', this.message)
}
})