luck 2015-07-02
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>无标题文档</title>
</head>
<scripttype="text/javascript"src="docs.js"></script>
<scripttype="text/javascript">
/*varb=true;
functionchang(){
vardivNo=byTag("div")[0];
/*
if(b)
{
divNo.style.height="8px";
divNo.style.overflow="hidden";
b=false;
}
else
{
divNo.style.height="8px";
divNo.style.overflow="visible";
b=true;
}
if(divNo.className=="close")
{
divNo.classname="open"
}else{
divNo.classname="close";
}
}
*/
functionlist(){
//vardtNo=byTag("dt")[0];
//vardlNo=byTag("dl")[0];
vardtNo=event.srcElement;
vardlNo=dtNo.parentNode;
if(dlNo.className=="open")
{
dlNo.classname="close";
}else{
dlNo.classname="open";
}
}
</script>
<styletype="text/css">
.open{
overflow:visible;
}
.close{
overflow:hidden;
}
dl{
overflow:hidden;
height:16px;
}
</style>
<body>
<dl>
<dtonclick="list()">列表</dt>
<dd>张三1</dd>
<dd>张三2</dd>
<dd>张三3</dd>
<dd>张三4</dd>
<dd>张三5</dd>
</dl>
<dl>
<dtonclick="list()">列表</dt>
<dd>张三1</dd>
<dd>张三2</dd>
<dd>张三3</dd>
<dd>张三4</dd>
<dd>张三5</dd>
</dl>
</body>
</html>
Vue和React是数据驱动视图,如何有效控制DOM操作?能不能把计算,更多的转移为js计算?因为js执行速度很快。patch函数-->patch,对比tag,对比tag与key,对比children