You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
519 B
26 lines
519 B
class DataUtil {
|
|
/**
|
|
* 设置差异数据
|
|
* @param component
|
|
* @param data
|
|
*/
|
|
setDiffData(component, data) {
|
|
const diffData = {};
|
|
|
|
// 遍历获取到有差异的数据
|
|
Object.keys(data).forEach(key => {
|
|
if (component.data[key] !== data[key]) {
|
|
diffData[key] = data[key];
|
|
}
|
|
});
|
|
|
|
// 设置数据
|
|
if (Object.keys(diffData).length) {
|
|
component.setData(diffData);
|
|
}
|
|
}
|
|
}
|
|
|
|
const dataUtil = new DataUtil;
|
|
export default dataUtil;
|