|
2 | 2 | import { version } from 'vue-demi' |
3 | 3 | import { reactive, ref, watch } from 'vue' |
4 | 4 | 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' |
7 | 10 |
|
8 | 11 | declare const __APP_VERSION__: string |
9 | 12 | const appVersion = __APP_VERSION__ |
10 | 13 |
|
11 | | -
|
12 | 14 | interface FormState { |
13 | 15 | language: string |
14 | 16 | theme: 'light' | 'dark' |
@@ -41,19 +43,22 @@ const formState = reactive<FormState>({ |
41 | 43 | maxHeight: '', |
42 | 44 | }) |
43 | 45 |
|
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 |
48 | 48 |
|
| 49 | +const oldString = ref(OLD_STRING) |
| 50 | +const newString = ref(NEW_STRING) |
| 51 | +
|
| 52 | +if (localStorage.getItem('oldString')) |
| 53 | + oldString.value = localStorage.getItem('oldString') |
49 | 54 | if (localStorage.getItem('newString')) |
50 | | - newString.value = localStorage.getItem('newString') ?? newShortText.value |
| 55 | + newString.value = localStorage.getItem('newString') |
51 | 56 |
|
52 | 57 | function resetText() { |
53 | 58 | localStorage.removeItem('oldString') |
54 | 59 | localStorage.removeItem('newString') |
55 | | - oldString.value = oldShortText.value |
56 | | - newString.value = newShortText.value |
| 60 | + oldString.value = OLD_STRING |
| 61 | + newString.value = NEW_STRING |
57 | 62 | } |
58 | 63 |
|
59 | 64 | function clearText() { |
|
0 commit comments