11<template >
22 <div class =" h-full" >
33 <main class =" container h-full mx-auto mt-24" >
4- <p v-for =" (lineDiff, index) in lhsDiff" :key =" index" >
5- <span v-html =" lineDiff" ></span >
6- </p >
7- <p v-for =" (lineDiff, index) in rhsDiff" :key =" index" >
8- <span v-html =" lineDiff" ></span >
9- </p >
4+ <div class =" flex gap-4 mt-5" >
5+ <div class =" flex-1 max-h-full p-4 border-2 rounded-sm" >
6+ <p v-for =" (lineDiff, index) in lhsDiff" :key =" index" >
7+ <span v-html =" lineDiff" ></span >
8+ </p >
9+ </div >
10+ <div class =" flex-1 max-h-full p-4 border-2 rounded-sm" >
11+ <p v-for =" (lineDiff, index) in rhsDiff" :key =" index" >
12+ <span v-html =" lineDiff" ></span >
13+ </p >
14+ </div >
15+ </div >
1016 </main >
1117 </div >
1218</template >
@@ -30,31 +36,34 @@ export default {
3036 }
3137 return dmp .diff_main (x, this .originalRhs [i])
3238 })
33- this .lhsDiff = diff .map ((lineDiff ) => {
34- return lineDiff
35- .map ((item ) => {
36- if (item[0 ] === - 1 || item[0 ] === 0 ) {
37- const className = item[0 ] === - 1 ? ' bg-red-300' : ' '
38- return ` <pre class="inline mr-[-4px] p-0 m-0 ${ className} ">${ item[1 ]} </pre>`
39- }
40- return ' '
41- })
42- .filter (Boolean )
43- .join (' \n ' )
44- })
45- this .rhsDiff = diff .map ((lineDiff ) => {
46- return lineDiff
47- .map ((item ) => {
48- if (item[0 ] === 1 || item[0 ] === 0 ) {
49- const className = item[0 ] === 1 ? ' bg-green-300' : ' '
50- return ` <pre class="inline mr-[-4px] p-0 m-0 ${ className} ">${ item[1 ]} </pre>`
51- }
52- return ' '
53- })
54- .filter (Boolean )
55- .join (' \n ' )
56- })
57- console .log (this .originalLhs , this .originalRhs , diff)
39+ this .lhsDiff = diff
40+ .map ((lineDiff ) => {
41+ return lineDiff
42+ .map ((item ) => {
43+ if (item[0 ] === - 1 || item[0 ] === 0 ) {
44+ const className = item[0 ] === - 1 ? ' bg-red-300' : ' '
45+ return ` <pre class="inline mr-[-4px] p-0 m-0 ${ className} ">${ item[1 ]} </pre>`
46+ }
47+ return ' '
48+ })
49+ .filter (Boolean )
50+ .join (' \n ' )
51+ })
52+ .filter (Boolean )
53+ this .rhsDiff = diff
54+ .map ((lineDiff ) => {
55+ return lineDiff
56+ .map ((item ) => {
57+ if (item[0 ] === 1 || item[0 ] === 0 ) {
58+ const className = item[0 ] === 1 ? ' bg-green-300' : ' '
59+ return ` <pre class="inline mr-[-4px] p-0 m-0 ${ className} ">${ item[1 ]} </pre>`
60+ }
61+ return ' '
62+ })
63+ .filter (Boolean )
64+ .join (' \n ' )
65+ })
66+ .filter (Boolean )
5867 },
5968 data () {
6069 return {
0 commit comments