v-code-diff
v-code-diff copied to clipboard
字符串中包含换行,能否忽略
<code-diff
old-string="const a = 2;"
:new-string="'const a = 2;\nlet b = 3;'"
></code-diff>
期望const a = 2;这段应该不是差异
有处理办法吗
@09473ZH
检查新旧字符串是否都以换行符\n结尾( 正则 /\n$/),如果不是的话,就在字符串末尾添加换行符,确保新旧字符串都是以换行符结尾,就可以处理这种情况了。