Open liangxuemin opened 2 years ago
After "objectHash" is configured, jsondiffpatch.formatters.html.showUnchanged cannot show the same value with different positions
let that = this; let secodeLists = JSON.parse(JSON.stringify(secodeData)); let deltas=null; let diffpatcher = jsondiffpatch.create({ objectHash: function(obj,index) { return obj.serviceCode ||obj.columns || '$$index:' + index; }, arrays: { // default true, detect items moved inside the array (otherwise they will be registered as remove+add) detectMove: true, // default false, the value of items moved is not included in deltas includeValueOnMove: false }, propertyFilter: function(name, context){ console.log('name', name, context) }, cloneDiffValues: false }); this.diffpatcher = diffpatcher; document.getElementById('visualsuat').innerHTML ='' tijiaodiff() function tijiaodiff(){ if (!firstData && !secodeLists) return; deltas = diffpatcher.diff(firstData, secodeLists); // console.log('deltas', deltas, JSON.stringify(deltas)) if (deltas) { that.isDisabled = false; document.getElementById('visualsuat').innerHTML = jsondiffpatch.formatters.html.format(deltas, firstData); } else { document.getElementById('visualsuat').innerHTML ='无对比结果' } if (!that.showUnchange) { jsondiffpatch.formatters.html.hideUnchanged(); } } jsondiffpatch.formatters.html.showUnchanged( target.checked, null, 800 );
After "objectHash" is configured, jsondiffpatch.formatters.html.showUnchanged cannot show the same value with different positions