Skip to content

删除掉初始数据文件并保存上次对比结果到浏览器缓存 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 42 additions & 10 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,83 @@
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="旧数据:">
<el-input v-model="oldStr" type="textarea" :autosize="{minRows: 2, maxRows: 15}" placeholder="请输入旧数据"></el-input>
<el-input
v-model="oldStr"
type="textarea"
:autosize="{minRows: 2, maxRows: 15}"
placeholder="请输入旧数据"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="新数据:">
<el-input v-model="newStr" type="textarea" :autosize="{minRows: 2, maxRows: 15}" placeholder="请输入新数据"></el-input>
<el-input
v-model="newStr"
type="textarea"
:autosize="{minRows: 2, maxRows: 15}"
placeholder="请输入新数据"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="展示效果:">
<el-switch v-model="fotmat" active-text="line-by-line" inactive-text="side-by-side"></el-switch>
<el-switch
v-model="fotmat"
active-text="line-by-line"
inactive-text="side-by-side"
></el-switch>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="差异化范围:">
<el-input-number v-model="context" placeholder=""></el-input-number>
<el-input-number
v-model="context"
placeholder=""
></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
<code-diff :old-string="oldStr" :new-string="newStr" :context="context" :output-format="outputFormat" />
<code-diff
:old-string="oldStr"
:new-string="newStr"
:context="context"
:output-format="outputFormat"
/>
</div>
</template>

<script>
import codeDiff from './lib/index.js'
import oldStr from './date/oldStr'
import newStr from './date/newStr'
export default {
name: 'App',
components: {
codeDiff
},
data () {
return {
oldStr,
newStr,
oldStr: '',
newStr: '',
fotmat: false,
context: 5
context: 10
}
},
computed: {
outputFormat () {
return this.fotmat ? 'line-by-line' : 'side-by-side'
}
},
watch: {
oldStr (v) {
localStorage.setItem('oldStr', v)
},
newStr (v) {
localStorage.setItem('newStr', v)
}
},
mounted () {
this.oldStr = localStorage.getItem('oldStr')
this.newStr = localStorage.getItem('newStr')
}
}
</script>
24 changes: 0 additions & 24 deletions src/date/newStr.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/date/oldStr.js

This file was deleted.