// 生成ast语法树 const ast = parse(template.trim(), options) // 标记静态内容(以免diff的时候需要重复比较) optimize(ast, options) // 生成render function code const code = generate(ast, options)
// 编译入口 src/compiller/index.js // html解析 src/compiller/parser/html-parser.js // src/compiller下的其它文件
//template
<div id="app">
<p>普通属性:{{ message }}</p>
<p>{{msg()}}</p>
<p>{{ct}}</p>
<input v-model="message">
<div v-for="item in items">
{{ item.text }}
</div>
<button v-on:click="bindClick">点我抓同伟</button>
</div>
// js
new Vue({
el: '#app',
data: {
message: '以vue的名义',
items: [{
text: '达康书记'
}, {
text: '育良书记'
}]
},
methods: {
bindClick: function() {
this.message = '这就抓同伟去';
},
msg: function() {
return this.message + "这个方法每次都会执行";
}
},
computed: {
ct: function() {
return this.message + "计算属性并不会每次都执行";
}
}
})
with(this) {
return _c('div', {
attrs: {
"id": "app"
}
},
[_c('p', [_v("普通属性:" + _s(message))]), _v(" "), _c('p', [_v(_s(msg()))]), _v(" "), _c('p', [_v(_s(ct))]), _v(" "), _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (message),
expression: "message"
}],
domProps: {
"value": (message)
},
on: {
"input": function($event) {
if ($event.target.composing) return;
message = $event.target.value
}
}
}), _v(" "), _l((items),
function(item) {
return _c('div', [_v("\n\t\t " + _s(item.text) + "\n\t ")])
}), _v(" "), _c('button', {
on: {
"click": bindClick
}
},
[_v("点我出奇迹抓同伟")])], 2)
}
_l((items),
function(item) {
return _c('div', [_v("\n\t\t " + _s(item.text) + "\n\t ")])
})
_c('button', {
on: {
"click": bindClick
}
}
constructor (
tag?: string, //标签名
data?: VNodeData, //属性数据,事件监听等
children?: ?Array<VNode>, //子节点
text?: string,
elm?: Node,
context?: Component,
componentOptions?: VNodeComponentOptions
) {
...
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有