🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

lw-code-diff

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lw-code-diff

代码比对展示(Code comparison display)

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
-60%
Maintainers
1
Weekly downloads
 
Created
Source

vue-code-diff

代码比对展示 demo

安装

yarn add vue-code-diff

使用

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

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

参数说明

参数说明类型可选值默认值
old-string陈旧的字符串string
new-string新的字符串string
context不同地方上下间隔多少行不隐藏number
outputFormat展示的方式stringline-by-line,side-by-sideline-by-line
drawFileList展示对比文件列表boolean-false
renderNothingWhenEmpty当无对比时不渲染boolean-false
diffStyle每行中对比差异级别stringword, charword
fileName文件名string-
isShowNoChange当无对比时展示源代码boolean-false

效果展示

line-by-line

image

side-by-side

image

LICENSE

MIT

Keywords

vue

FAQs

Package last updated on 30 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts