1.数据问题
b并不是a的克隆,而是指向同一份数据的另一个指针
let a = [1,2,3,4,5] let b = a b[0] = 6 console.log(a) // [6, 2, 3, 4, 5]
Object.assign({},a)用于将一个或多个源对象的所有可枚举属性,复制到目标对象,深度复制 let c = Object.assign([],a) c[0] = 6 console.log(c) // [6, 2, 3, 4, 5] console.log(a) // [1, 2, 3, 4, 5]
2.双边距BUG(ie)
上下两个垂直排列的元素
.box1{margin-bottom: 10px;border: 1px dotted red;}
.box2{margin-top: 20px;border: 1px dotted red;}
解决方法:
浮动:float:left
外层元素:overflow:hidden
3.margin:0 auto(ie不生效)
首先页首必须设置文档类型:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transition al.dtd">
且在head内添加:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/> 即可!
原文:https://www.cnblogs.com/naturl/p/11763553.html