Skip to content

Commit b244846

Browse files
committed
删除掉无用的初始数据文件并进行保存上次对比结果到浏览器缓存的功能
1 parent c1127c2 commit b244846

File tree

3 files changed

+42
-58
lines changed

3 files changed

+42
-58
lines changed

src/App.vue

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,83 @@
44
<el-row :gutter="10">
55
<el-col :span="12">
66
<el-form-item label="旧数据:">
7-
<el-input v-model="oldStr" type="textarea" :autosize="{minRows: 2, maxRows: 15}" placeholder="请输入旧数据"></el-input>
7+
<el-input
8+
v-model="oldStr"
9+
type="textarea"
10+
:autosize="{minRows: 2, maxRows: 15}"
11+
placeholder="请输入旧数据"
12+
></el-input>
813
</el-form-item>
914
</el-col>
1015
<el-col :span="12">
1116
<el-form-item label="新数据:">
12-
<el-input v-model="newStr" type="textarea" :autosize="{minRows: 2, maxRows: 15}" placeholder="请输入新数据"></el-input>
17+
<el-input
18+
v-model="newStr"
19+
type="textarea"
20+
:autosize="{minRows: 2, maxRows: 15}"
21+
placeholder="请输入新数据"
22+
></el-input>
1323
</el-form-item>
1424
</el-col>
1525
<el-col :span="12">
1626
<el-form-item label="展示效果:">
17-
<el-switch v-model="fotmat" active-text="line-by-line" inactive-text="side-by-side"></el-switch>
27+
<el-switch
28+
v-model="fotmat"
29+
active-text="line-by-line"
30+
inactive-text="side-by-side"
31+
></el-switch>
1832
</el-form-item>
1933
</el-col>
2034
<el-col :span="12">
2135
<el-form-item label="差异化范围:">
22-
<el-input-number v-model="context" placeholder=""></el-input-number>
36+
<el-input-number
37+
v-model="context"
38+
placeholder=""
39+
></el-input-number>
2340
</el-form-item>
2441
</el-col>
2542
</el-row>
2643
</el-form>
27-
<code-diff :old-string="oldStr" :new-string="newStr" :context="context" :output-format="outputFormat" />
44+
<code-diff
45+
:old-string="oldStr"
46+
:new-string="newStr"
47+
:context="context"
48+
:output-format="outputFormat"
49+
/>
2850
</div>
2951
</template>
3052

3153
<script>
3254
import codeDiff from './lib/index.js'
33-
import oldStr from './date/oldStr'
34-
import newStr from './date/newStr'
3555
export default {
3656
name: 'App',
3757
components: {
3858
codeDiff
3959
},
4060
data () {
4161
return {
42-
oldStr,
43-
newStr,
62+
oldStr: '',
63+
newStr: '',
4464
fotmat: false,
45-
context: 5
65+
context: 10
4666
}
4767
},
4868
computed: {
4969
outputFormat () {
5070
return this.fotmat ? 'line-by-line' : 'side-by-side'
5171
}
72+
},
73+
watch: {
74+
oldStr (v) {
75+
localStorage.setItem('oldStr', v)
76+
},
77+
newStr (v) {
78+
localStorage.setItem('newStr', v)
79+
}
80+
},
81+
mounted () {
82+
this.oldStr = localStorage.getItem('oldStr')
83+
this.newStr = localStorage.getItem('newStr')
5284
}
5385
}
5486
</script>

src/date/newStr.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/date/oldStr.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)