Shimada666 / v-code-diff

A vue code diff display plugin, support Vue2 / Vue3
https://shimada666.github.io/v-code-diff/
MIT License
407 stars 67 forks source link

字符串中包含换行,能否忽略 #143

Open linlinyang opened 6 months ago

linlinyang commented 6 months ago

参考demo

  <code-diff
      old-string="const a = 2;"
      :new-string="'const a = 2;\nlet b = 3;'"
  ></code-diff>

期望const a = 2;这段应该不是差异 有处理办法吗

Shimada666 commented 6 months ago

@09473ZH

Jebediah-Hang commented 5 months ago

检查新旧字符串是否都以换行符\n结尾( 正则 /\n$/),如果不是的话,就在字符串末尾添加换行符,确保新旧字符串都是以换行符结尾,就可以处理这种情况了。