Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mixin(des, src)存在错误 #2

Open
381510688 opened this issue Feb 10, 2017 · 1 comment
Open

mixin(des, src)存在错误 #2

381510688 opened this issue Feb 10, 2017 · 1 comment

Comments

@381510688
Copy link

var a = {
    "pt": {
        "common": {
            "a": 1,
            "c": 3
        }
    }
};
var b = {
    "pt": {
        "common": {
            "a": 2,
            "d": 3
        }
    }
}
console.log(mixin(a, b))

结果显示
image

@akira-cn
Copy link
Member

akira-cn commented Apr 6, 2017

默认复制des上不存在而src上存在的属性,会忽略掉des上已经存在的属性,要强制覆盖需要:

console.log(mixin(a, b, true));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants