fix: 修复版本号显示不正确的问题 (#595)

This commit is contained in:
ayangweb
2025-07-28 16:55:10 +08:00
committed by GitHub
parent 36aaf1067e
commit c33703e368
3 changed files with 10 additions and 8 deletions

View File

@@ -35,6 +35,7 @@ onMounted(async () => {
generateColorVars()
await appStore.$tauri.start()
await appStore.init()
await modelStore.$tauri.start()
await modelStore.init()
await catStore.$tauri.start()

View File

@@ -78,15 +78,15 @@ watch(() => modelStore.currentModel, async (model) => {
}
}, { deep: true, immediate: true })
watch([() => catStore.scale, modelSize], async () => {
if (!modelSize.value) return
watch([() => catStore.scale, modelSize], async ([scale, modelSize]) => {
if (!modelSize) return
const { width, height } = modelSize.value
const { width, height } = modelSize
appWindow.setSize(
new PhysicalSize({
width: Math.round(width * (catStore.scale / 100)),
height: Math.round(height * (catStore.scale / 100)),
width: Math.round(width * (scale / 100)),
height: Math.round(height * (scale / 100)),
}),
)
}, { immediate: true })

View File

@@ -2,21 +2,22 @@ import type { WindowState } from '@/composables/useWindowState'
import { getName, getVersion } from '@tauri-apps/api/app'
import { defineStore } from 'pinia'
import { onMounted, reactive, ref } from 'vue'
import { reactive, ref } from 'vue'
export const useAppStore = defineStore('app', () => {
const name = ref('')
const version = ref('')
const windowState = reactive<WindowState>({})
onMounted(async () => {
const init = async () => {
name.value = await getName()
version.value = await getVersion()
})
}
return {
name,
version,
windowState,
init,
}
})