Vue模板语法
在底层的实现上,vue将模板编译成成虚拟DOM渲染函数。
虚拟DOM是什么呢?请看戴戴大神的博文:点击打开链接
链接地址:https://github.com/livoras/blog/issues/13
----------------------------------------------------------------------------------------------------------------
我试了试,js创建DOM树
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>virtual dom</title>
</head>
<body>
</body>
<script>
//js对象模拟DOM树
var element={
tagName:'ul',
props:{
id:'app-1'
},
children:[
{
tagName:'li',props:{class:'item'},children:"item 1"
},
{
tagName:'li',props:{class:'item'},children:"item 2"
},
{
tagName:'li',props:{class:'item'},children:"item 3"
}
]
}
</script>
</html>
戴戴大神的其他代码,应该是react.js吧, JSX的语法,我没学过,所以就没手敲,懂意思就这样吧。