@git-diff-view/vue
npm install @git-diff-view/vue> A high-performance Vue diff view component with GitHub-style UI


- ✅ Split & Unified views
- ✅ Syntax highlighting with full context
- ✅ Light & Dark themes
- ✅ SSR support
- ✅ Vue 3 composition API
- ✅ Widget & extend data system with slots
- ✅ High performance with Web Worker support
``bash`
npm install @git-diff-view/vueor
pnpm add @git-diff-view/vueor
yarn add @git-diff-view/vue
`vue
:diff-view-mode="DiffModeEnum.Split"
diff-view-theme="dark"
:diff-view-highlight="true"
/>
`
File Comparison Mode
`vue
`
Git Diff Mode
`vue
`
`vue`
| Prop | Type | Description |
|------|------|-------------|
| data | DiffData | Diff data with oldFile, newFile, and hunks |diffFile
| | DiffFile | Pre-processed diff file instance |diffViewMode
| | Split \| Unified | View mode (default: Split) |diffViewTheme
| | light \| dark | Theme (default: light) |diffViewHighlight
| | boolean | Enable syntax highlighting |diffViewWrap
| | boolean | Enable line wrapping |diffViewFontSize
| | number | Font size in pixels |diffViewAddWidget
| | boolean | Enable widget button |extendData
| | ExtendData | Additional data per line |
| Slot | Props | Description |
|------|-------|-------------|
| widget | { onClose, side, lineNumber } | Custom widget content |extend
| | { data } | Custom extend data content |
| Event | Payload | Description |
|-------|---------|-------------|
| onAddWidgetClick | { side, lineNumber } | Fired when widget button is clicked |
`typescript``
type DiffData = {
oldFile?: {
fileName?: string | null;
fileLang?: string | null;
content?: string | null;
};
newFile?: {
fileName?: string | null;
fileLang?: string | null;
content?: string | null;
};
hunks: string[];
};
- Basic Vue Example
- Vue SSR Example
Try it online: https://mrwangjusttodo.github.io/git-diff-view
MIT © MrWangJustToDo