- mixin
function mixin(a,b){
for(let key in b){
a[key] = b[key]
}
}
将b的每一项拷贝到a上,深拷贝
- Object.assign
相当于
Object.assign(a,b)
function mixin(a,b){
for(let key in b){
a[key] = b[key]
}
}
将b的每一项拷贝到a上,深拷贝
Object.assign(a,b)
本文标题:2018-06-04 ES5的mixin模式,ES6的Objec
本文链接:https://www.haomeiwen.com/subject/whrusftx.html
网友评论