Skip to content

Commit c4a9e0e

Browse files
committed
feat: add filename & newFilename for demo
1 parent acfc6f7 commit c4a9e0e

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README-zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Vue.use(CodeDiff);
121121
| maxHeight | 组件最大高度,例如 300px | string | - | undefined |
122122
| filename | 文件名 | string | - | undefined |
123123
| newFilename | 新文件文件名 | string | - | undefined |
124-
| theme | 用于切换日间模式/夜间模式 | ThemeType | light , dark | 'light' |
124+
| theme | 用于切换日间模式/夜间模式 | ThemeType | light , dark | light |
125125

126126
## 组件事件
127127

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Not recommended, but the relevant capabilities are retained to facilitate migrat
123123
| maxHeight | Maximum height of component, for example: 300px | string | - | undefined |
124124
| filename | Filename | string | - | undefined |
125125
| newFilename | New filename | string | - | undefined |
126-
| theme | Add dark mode | ThemeType | light , dark | 'light' |
126+
| theme | Add dark mode | ThemeType | light , dark | light |
127127

128128
## Events
129129

demo/App.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const formState = reactive({
1313
trim: false,
1414
noDiffLineFeed: false,
1515
filename: 'package.json',
16+
newFilename: 'newPackage.json',
1617
hideHeader: false,
1718
hideStat: false,
1819
})
@@ -59,12 +60,18 @@ function printEvent(e) {
5960
<a-button><a href="https://github.com/Shimada666/v-code-diff">View on Github</a></a-button>
6061
</div>
6162
<div style="display: flex; justify-content: space-between;">
62-
<textarea v-model="oldString" style="width: 48vw; margin-right: 10px;" :rows="20" />
63-
<textarea v-model="newString" style="width: 48vw;" :rows="20" />
63+
<div style="margin-right: 5px;">
64+
<a-input v-model:value="formState.filename" />
65+
<textarea v-model="oldString" style="width: 48vw;" :rows="20" />
66+
</div>
67+
<div>
68+
<a-input v-model:value="formState.newFilename" />
69+
<textarea v-model="newString" style="width: 48vw;" :rows="20" />
70+
</div>
71+
6472
</div>
6573
<div style="margin-top: 10px;">
66-
<a-button style="margin-right: 5px;"
67-
@click="resetText">
74+
<a-button style="margin-right: 5px;" @click="resetText">
6875
重置文本(reset text)
6976
</a-button>
7077
<a-button type="default" @click="clearText">
@@ -152,8 +159,8 @@ function printEvent(e) {
152159
<div>
153160
<CodeDiff :theme="formState.theme" :old-string="oldString" :new-string="newString" :language="formState.language"
154161
:diff-style="formState.diffStyle" :output-format="formState.outputFormat" :context="formState.context"
155-
:trim="formState.trim" :no-diff-line-feed="formState.noDiffLineFeed" filename="File Name"
156-
new-filename="New File Name" :hide-header="formState.hideHeader" :hide-stat="formState.hideStat"
162+
:trim="formState.trim" :no-diff-line-feed="formState.noDiffLineFeed" :filename="formState.filename"
163+
:new-filename="formState.newFilename" :hide-header="formState.hideHeader" :hide-stat="formState.hideStat"
157164
@diff="printEvent" />
158165
</div>
159166
</div>

0 commit comments

Comments
 (0)