Skip to content

Commit 3ae8d36

Browse files
committed
chore: upgrade typescript4.7.3 & fix type definition
1 parent 833502d commit 3ae8d36

File tree

8 files changed

+19
-16
lines changed

8 files changed

+19
-16
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
VITE_APP_PUBLIC_PATH=/
22
VITE_APP_PREVIEW=true
3-
VITE_APP_API_BASE_URL=/api
3+
VITE_APP_API_BASE_URL=/api

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ VITE_APP_PREVIEW=true
22
VITE_APP_API_BASE_URL=/api
33
VITE_MOCK=true
44
VITE_HTTP_MOCK=true
5+

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
NODE_ENV=production
22
VITE_APP_PREVIEW=false
3-
VITE_APP_API_URL=/api
3+
VITE_APP_API_URL=/api

build/mockServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ const createMockServer = () => {
1010
return mockTarget
1111
}
1212

13-
export default createMockServer
13+
export default createMockServer

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"mockjs": "^1.1.0",
4343
"plop": "^3.1.0",
4444
"postcss-px-to-viewport-8-plugin": "^1.1.3",
45-
"typescript": "^4.5.4",
45+
"typescript": "4.7.3",
4646
"umi-mock-middleware2": "^1.0.2",
4747
"unplugin-vue-components": "^0.19.6",
4848
"vite": "^2.9.9",

src/App.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77

88
<script lang="ts">
99
import { defineComponent, ref, watch } from 'vue'
10+
import type { ConfigProviderTheme } from 'vant'
1011
export default defineComponent({
1112
setup() {
12-
const theme = ref('dark')
13-
const checked = ref(true)
13+
const theme = ref<ConfigProviderTheme>('light')
14+
const checked = ref<boolean>(false)
1415
15-
watch(
16-
checked,() => {
17-
if(checked.value) {
18-
document.getElementsByTagName('html')[0].setAttribute('data-theme', 'data-theme-dark')
19-
} else {
20-
document.getElementsByTagName('html')[0].setAttribute('data-theme', 'data-theme-light')
21-
}
22-
}, { immediate: true })
16+
watch(checked,() => {
17+
if(checked.value) {
18+
theme.value = 'dark'
19+
document.getElementsByTagName('html')[0].setAttribute('data-theme', 'data-theme-dark')
20+
} else {
21+
theme.value = 'light'
22+
document.getElementsByTagName('html')[0].setAttribute('data-theme', 'data-theme-light')
23+
}
24+
})
2325
2426
return {
2527
theme,

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"allowSyntheticDefaultImports": true,
1111
"sourceMap": true,
1212
"baseUrl": ".",
13-
"types": [],
13+
"types": ["node"],
1414
"paths": {
1515
"@/*": ["src/*"]
1616
},

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,7 @@ type-is@~1.6.18:
33373337
media-typer "0.3.0"
33383338
mime-types "~2.1.24"
33393339

3340-
typescript@^4.5.4:
3340+
typescript@4.7.3:
33413341
version "4.7.3"
33423342
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d"
33433343
integrity sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==

0 commit comments

Comments
 (0)