Skip to content

Commit c33703e

Browse files
authored
fix: 修复版本号显示不正确的问题 (#595)
1 parent 36aaf10 commit c33703e

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/App.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ onMounted(async () => {
3535
generateColorVars()
3636
3737
await appStore.$tauri.start()
38+
await appStore.init()
3839
await modelStore.$tauri.start()
3940
await modelStore.init()
4041
await catStore.$tauri.start()

src/pages/main/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ watch(() => modelStore.currentModel, async (model) => {
7878
}
7979
}, { deep: true, immediate: true })
8080
81-
watch([() => catStore.scale, modelSize], async () => {
82-
if (!modelSize.value) return
81+
watch([() => catStore.scale, modelSize], async ([scale, modelSize]) => {
82+
if (!modelSize) return
8383
84-
const { width, height } = modelSize.value
84+
const { width, height } = modelSize
8585
8686
appWindow.setSize(
8787
new PhysicalSize({
88-
width: Math.round(width * (catStore.scale / 100)),
89-
height: Math.round(height * (catStore.scale / 100)),
88+
width: Math.round(width * (scale / 100)),
89+
height: Math.round(height * (scale / 100)),
9090
}),
9191
)
9292
}, { immediate: true })

src/stores/app.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@ import type { WindowState } from '@/composables/useWindowState'
22

33
import { getName, getVersion } from '@tauri-apps/api/app'
44
import { defineStore } from 'pinia'
5-
import { onMounted, reactive, ref } from 'vue'
5+
import { reactive, ref } from 'vue'
66

77
export const useAppStore = defineStore('app', () => {
88
const name = ref('')
99
const version = ref('')
1010
const windowState = reactive<WindowState>({})
1111

12-
onMounted(async () => {
12+
const init = async () => {
1313
name.value = await getName()
1414
version.value = await getVersion()
15-
})
15+
}
1616

1717
return {
1818
name,
1919
version,
2020
windowState,
21+
init,
2122
}
2223
})

0 commit comments

Comments
 (0)