vue 项目中 文件对比 vue-code-diff 和 DiffMatchPatch
vue 项目中 文件对比
刚开始是用的 vue-code-diff
安装
npm install vue-code-diff
使用
diff v-if="oldValue&&newValue" :old-string="oldValue" :new-string="newValue" :context="10" outputFormat="side-by-side" /> // js代码 import CodeDiff from 'vue-code-diff' components: { CodeDiff }, data() { return { oldValue: null, newValue: null, } }, getText() { this.axios({}).then((res) => { this.oldValue = res.data.old this.newValue = res.data.value }) },
但是当后台接口数据大的时候, 页面会响应不过来