Skip to content

soldatovsh/vue-code-diff

 
 

Repository files navigation

代码比对展示 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

About

vue文件差异对比

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 87.5%
  • Vue 11.7%
  • HTML 0.8%