Skip to content

Commit 6687c6e

Browse files
committed
feat: demo 页示例数据导入方式修改
1 parent 442495c commit 6687c6e

11 files changed

Lines changed: 41685 additions & 13131 deletions

demo/App.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
import { version } from 'vue-demi'
33
import { reactive, ref, watch } from 'vue'
44
import { useI18n } from 'vue-i18n'
5-
import { newShortText } from './text/new-short-text'
6-
import { oldShortText } from './text/old-short-text'
5+
6+
import oldShortText from './text/old-short-text.txt?raw'
7+
import newShortText from './text/new-short-text.txt?raw'
8+
import oldLongText from './text/old-long-text.txt?raw'
9+
import newLongText from './text/new-long-text.txt?raw'
710
811
declare const __APP_VERSION__: string
912
const appVersion = __APP_VERSION__
1013
11-
1214
interface FormState {
1315
language: string
1416
theme: 'light' | 'dark'
@@ -41,19 +43,22 @@ const formState = reactive<FormState>({
4143
maxHeight: '',
4244
})
4345
44-
const oldString = ref(oldShortText.value)
45-
const newString = ref(newShortText.value)
46-
if (localStorage.getItem('oldString'))
47-
oldString.value = localStorage.getItem('oldString') ?? oldShortText.value
46+
const OLD_STRING = oldLongText
47+
const NEW_STRING = newLongText
4848
49+
const oldString = ref(OLD_STRING)
50+
const newString = ref(NEW_STRING)
51+
52+
if (localStorage.getItem('oldString'))
53+
oldString.value = localStorage.getItem('oldString')
4954
if (localStorage.getItem('newString'))
50-
newString.value = localStorage.getItem('newString') ?? newShortText.value
55+
newString.value = localStorage.getItem('newString')
5156
5257
function resetText() {
5358
localStorage.removeItem('oldString')
5459
localStorage.removeItem('newString')
55-
oldString.value = oldShortText.value
56-
newString.value = newShortText.value
60+
oldString.value = OLD_STRING
61+
newString.value = NEW_STRING
5762
}
5863
5964
function clearText() {

demo/text/new-long-text.js

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

demo/text/new-long-text.txt

Lines changed: 25435 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import { ref } from 'vue-demi'
2-
3-
export const newShortText = ref(`
41
{
52
"name": "v-code-diff",
63
"description": "A diff plugin of vue, support vue2 and vue3",
@@ -114,5 +111,3 @@ export const newShortText = ref(`
114111
]
115112
}
116113
}
117-
`,
118-
)

0 commit comments

Comments
 (0)