GitHub
github.com › qinxm › vue-json-diff
GitHub - qinxm/vue-json-diff: A vue json diff component that based on feHelper.
<template> <div id="app"> <json-diff :jsonSourceLeft="leftData" :jsonSourceRight="rightData" /> </div> </template> <script> import JsonDiff from 'vue-json-diff' export default { components: { JsonDiff }, data() { return { leftData: { "data": { "needQueryPosition": 0, "orderStatus": "已取消", "orderTrace": { "timeLine": [ { "date": "10/13", "time": "18:26", "status": "订单已取消" }, { "date": "10/13", "time": "18:11", "status": "订单提交成功" } ], "lastStatusDesc": "订单未支付,已自动取消" } }, "code": 0, "msg": "", "success": true }, rightData: { "data": { "needQueryPo
Starred by 27 users
Forked by 10 users
Languages CSS 40.9% | Vue 29.6% | JavaScript 29.5%
npm
npmjs.com › package › json-diff-kit
json-diff-kit - npm
Here is an experimental Vue version of the Viewer component. Please check the playground page, where you can adjust nearly all parameters and see the result. You can use the CLI tool to generate the diff data from two JSON files.
» npm install json-diff-kit
Published Mar 03, 2026
Version 1.0.35
Author Rex Zeng
Repository https://github.com/RexSkz/json-diff-kit
CodeSandbox
codesandbox.io › examples › package › vue-json-diff
vue-json-diff examples - CodeSandbox
Use this online vue-json-diff playground to view and fork vue-json-diff example apps and templates on CodeSandbox.
GitHub
github.com › RexSkz › json-diff-kit-vue
GitHub - RexSkz/json-diff-kit-vue: The Vue version of Viewer used by json-diff-kit. (Beta) · GitHub
<script setup lang="ts"> import { Differ, Viewer } from '@json-diff-kit/viewer-vue'; import type { DifferOptions, ViewerProps } from '@json-diff-kit/viewer-vue'; const differProps: DifferOptions = { detectCircular: false, maxDepth: Infinity, showModifications: true, arrayDiffMethod: 'lcs', ignoreCase: false, recursiveEqual: true, preserveKeyOrder: true, }; const differ = new Differ(differProps); const before = { a: 1, b: 2, c: 3 }; const after = { a: 1, b: 3, d: 4 }; const diff = differ.diff(before, after); const viewerProps: Partial<ViewerProps> = { diff, indent: 2, lineNumbers: true, highlig
Author RexSkz
npm
npmjs.com › package › vue-diff
vue-diff - npm
Insert the diff component with props. <template> <!-- If the changed componentName <VueDiff> --> <Diff :mode="mode" :theme="theme" :language="language" :prev="prev" :current="current" /> </template>
» npm install vue-diff
npm
npmjs.com › package › vue-json-diff
vue-json-diff - npm
<template> <div id="app"> <json-diff :jsonSourceLeft="leftData" :jsonSourceRight="rightData" /> </div> </template> <script> import JsonDiff from 'vue-json-diff' export default { components: { JsonDiff }, data() { return { leftData: { "data": { "needQueryPosition": 0, "orderStatus": "已取消", "orderTrace": { "timeLine": [ { "date": "10/13", "time": "18:26", "status": "订单已取消" }, { "date": "10/13", "time": "18:11", "status": "订单提交成功" } ], "lastStatusDesc": "订单未支付,已自动取消" } }, "code": 0, "msg": "", "success": true }, rightData: { "data": { "needQueryPo
» npm install vue-json-diff
GitHub
github.com › 5SSS › vue-json-compare
GitHub - 5SSS/vue-json-compare: vue(2.x) json compare components,live demo:https://codesandbox.io/s/suspicious-elion-bwl6v?file=/src/App.vue
<template> <div> <vue-json-compare :oldData="oldData" :newData="newData"></vue-json-compare> </div> </template> import vueJsonCompare from 'vue-json-compare'; const oldData = { name: 'super', age: 18, task: [ { name: 'eat', time: '09:00' }, { name: 'work', time: '10:00', deleted: 'this prop has been deleted!'
Starred by 45 users
Forked by 11 users
Languages Vue 58.7% | JavaScript 41.3%
npm
npmjs.com › package › vue-json-compare
vue-json-compare - npm
A vue(2.x) components for compare JSON data. Latest version: 3.0.0, last published: 5 years ago. Start using vue-json-compare in your project by running `npm i vue-json-compare`. There are 3 other projects in the npm registry using vue-json-compare.
» npm install vue-json-compare
Published Aug 20, 2020
Version 3.0.0
Author alpaca
GitHub
github.com › hoiheart › vue-diff
GitHub - hoiheart/vue-diff: VueJS diff viewer plugin
You can see the difference between the two codes with the vue-diff plugin. This plugin dependent on diff-match-patch and highlight.js, shows similar results to other diff viewers (e.g., Github Desktop).
Starred by 205 users
Forked by 18 users
Languages TypeScript 57.2% | Vue 31.7% | SCSS 6.6% | HTML 3.7% | JavaScript 0.8%
GitHub
github.com › yarsky-tgz › vue-jsondiffpatch
GitHub - yarsky-tgz/vue-jsondiffpatch: Diff & patch JavaScript objects
var jsondiffpatch = require('jsondiffpatch').create({ // used to match objects when diffing arrays, by default only === operator is used objectHash: function(obj) { // this function is used only to when objects are not equal by ref return obj._id || obj.id; }, 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 }, textDiff: { // default 60, minimum string length (left and right sides) to use text diff algorythm: google-diff-match-patch minLength: 60 }, propertyFilter: function(name, context) { /* this optional function can be specified to ignore object properties (eg.
Author yarsky-tgz
Top answer 1 of 4
1
Since the listing is an array and not an object you need to loop over it with index:
function checkOccurence(data, listing) {
let dataFound = false;
for(let i = 0; i < listing.length; i++) {
if (listing[i].pid === data.pid) {
dataFound = true;
break;
}
}
return dataFound;
};
Then you can use the returned boolean in your render to determine success or failure like this:
<div if="checkOccurence(data, listing)"> Success </div> <div v-else>Failure</div>
2 of 4
1
define exists method in your methods ,
methods: {
exists: function() {
var exist = false;
var listings = self.listings;
var data = self.data;
for(var listing of listings) {
if (listing.pid == data.pid) {
exist = true;
break;
}
}
return exist;
}
}
And you should call the method like this,
<div if="exists()"> Success </div> <div v-else> Failure</div>
Vue.js Examples
vuejsexamples.com › a-vue-components-for-compare-json-data
A vue components for compare JSON data
January 3, 2019 - <template> <div> <vue-json-compare :oldData="oldData" :newData="newData"></vue-json-compare> </div> </template> import vueJsonCompare from 'vue-json-compare' export default { components: { vueJsonCompare }, data () { return { oldData: { a: 1, e: 0 }, newData: { a: 2 b: 3 } } } } Json ·
Juejin
juejin.cn › post › 6886382426332299272
vue-json-diff组件封装- 掘金
We cannot provide a description for this page right now
Socket
socket.dev › npm › package › vue-json-diff-fehelper9
vue-json-diff-fehelper9 - npm Package Security Analysis - So...
<template> <div id="app"> <json-diff :jsonSourceLeft="leftData" :jsonSourceRight="rightData" /> </div> </template> <script> import JsonDiff from 'vue-json-diff-fehelper' export default { components: { JsonDiff }, data() { return { leftData: { "data": { "needQueryPosition": 0, "orderStatus": "已取消", "orderTrace": { "timeLine": [ { "date": "10/13", "time": "18:26", "status": "订单已取消" }, { "date": "10/13", "time": "18:11", "status": "订单提交成功" } ], "lastStatusDesc": "订单未支付,已自动取消" } }, "code": 0, "msg": "", "success": true }, rightData: { "data": { "ne
Top answer 1 of 2
2
First off create a method that will return appropriate icon. I believe the code of getIconClass method is self-explanatory. Then loop through leafs field in template and display name of the leaf and appropriate icon.
new Vue({
el: "#app",
data() {
return {
generalQuestInfo: [{
"id": 1,
"name": "Breaking News",
"alias": "BN",
"globalId": 1,
"platform": "Win64",
"pathway": {
"status": "Robot",
"name": "start case",
"leafs": ["start", "teleport", "take photo", "kill", "finish"]
}
}],
finishedQuestleafs: [
{ name: "start", questId: 2 },
{ name: "teleport", questId: 1 },
{ name: "take photo", questId: 1 },
{ name: "kill", questId: 1 },
{ name: "finish", questId: 1 },
{ name: "start", questId: 2 }
]
}
},
methods: {
getIconClass(id, leaf) {
return this.finishedQuestleafs.find(item => item.questId === id && item.name === leaf) ? "fa fa-check" : "fa fa-bomb";
}
}
})
.as-console-wrapper { max-height: 100% !important; top: 0; }
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<table align="center">
<tr>
<th>Status</th>
<th>Path name</th>
<th>Leafs Info</th>
</tr>
<tr v-for="data in generalQuestInfo" :key="data.id">
<td>{{data.pathway.status}}</td>
<td>{{data.pathway.name}}</td>
<td>
<ul>
<li v-for="(leaf, index) in data.pathway.leafs" :key="index">
<i :class="getIconClass(data.id, leaf)"></i> {{ leaf }}
</li>
</ul>
</td>
</tr>
</table>
</div>
2 of 2
1
You could try making a method to check while you're in the v-for loop.
<tr v-for="data in generalQuestInfo">
<span v-if="hasQuestFinished(data.id, data.pathway.leafs)">
<!-- display stuff if hasQuestFinished() returned true -->
</span>
</tr>
And in your vue object (assuming you only want to check if its in the array:
methods:{
hasQuestFinished(questID, givenQuests){
finishedQuestleafs.forEach(function(leaf){
if(leaf.questId == questID && givenQuests.indexOF(leaf.name) >= 0){
return true;
}
});
//finished the loop without returning means no match
return false;
}
}
CodeSandbox
codesandbox.io › examples › package › vue-json-compare
vue-json-compare examples - CodeSandbox
AboutA vue(2.x) components for compare JSON data4,139Weekly Downloads · Latest version3.0.0 · LicenseMIT · External Links ·