'admin-21.08.01:更新修复请查看CHANGELOG.md文件或查看标签'

This commit is contained in:
lyt-Top
2021-08-01 18:30:30 +08:00
parent 1dd6b653e7
commit 28edd79b1c
29 changed files with 523 additions and 383 deletions

View File

@ -14,3 +14,28 @@ export function judementSameArr(news: Array<string>, old: Array<string>): boolea
}
return count === leng ? true : false;
}
/**
* 判断两个对象是否相同
* @param a 要比较的对象一
* @param b 要比较的对象二
* @returns 相同返回 true反之则反
*/
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
if (!a || !b) return false;
let aProps = Object.getOwnPropertyNames(a);
let bProps = Object.getOwnPropertyNames(b);
if (aProps.length != bProps.length) return false;
for (let i = 0; i < aProps.length; i++) {
let propName = aProps[i];
let propA = a[propName];
let propB = b[propName];
if (!b.hasOwnProperty(propName)) return false;
if (propA instanceof Object) {
if (!isObjectValueEqual(propA, propB)) return false;
} else if (propA !== propB) {
return false;
}
}
return true;
}