// 对比方法
function diff() {
  if (
    this.content1 == "" ||
    this.content2 == "" ||
    this.content1 == undefined ||
    this.content2 == undefined
  ) {
    this.$Message.error(this.$t(700149));
    return false;
  }
  let left = this.content1,
    right = this.content2;
  // 默认左边的文件行多
  this.diffshow = true;
  var changePosition = false;
  if (left.length < right.length) {
    var tmp = left;
    left = right;
    right = tmp;
    changePosition = true;
  }
  let html = "";
  for (let i = 0; i < left.length; i++) {
    // html += `<p class="number">${i}</p>`;
    let txt1 = "",
      txt2 = "",
      num = 0;
    if (changePosition) {
      if (right[i]) {
        txt1 = right[i];
      } else {
        txt1 = "";
      }
      txt2 = left[i];
    } else {
      if (right[i]) {
        txt2 = right[i];
      } else {
        txt2 = "";
      }
      txt1 = left[i];
    }

    num = i + 1;

    if (txt2 == txt1) {
      html += `<tr>
    <td style="background:#ddd;display:inline-block;text-align:center;padding:0px 5px;min-width:30px;">${num}</td>
    <td style="background:#F9F9F9;padding:0px 5px;width:50%;">${txt1}</td>
    <td style="background:#F9F9F9;padding:0px 5px;width:50%;">${txt2}</td>
    </tr>`;
    } else {
      html += `<tr>
    <td style="background:#ddd;display:inline-block;text-align:center;padding:0px 5px;min-width:30px;">${num}</td>
    <td style="background:#FF7F00;padding:0px 5px;width:50%;">${txt1}</td>
    <td style="background:#BCD2EE;padding:0px 5px;width:50%;">${txt2}</td>
    </tr>`;
    }
  }
  this.diffhtml = html;
}
