Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.18 KB

README.md

File metadata and controls

49 lines (38 loc) · 1.18 KB

代码比对展示 demo

安装

yarn add vue-code-diff

使用

<template>
  <div>
    <code-diff :old-string="oldStr" :new-string="newStr" :context="10" />
  </div>
</template>

import vueCodeDiff from 'vue-code-diff'
export default {
  components: {vueCodeDiff},
  data(){
    return {
      oldStr: 'old code',
      newStr: 'new code'
    }
  }
}

参数说明

参数 说明 类型 可选值 默认值
old-string 陈旧的字符串 string
new-string 新的字符串 string
context 不同地方上下间隔多少行不隐藏 number
outputFormat 展示的方式 string line-by-line,side-by-side line-by-line

效果展示

line-by-line

image

side-by-side

image

LICENSE

MIT