mirror of
https://github.com/ayangweb/BongoCat.git
synced 2026-03-12 17:51:48 +08:00
fix: 修复版本号显示不正确的问题 (#595)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user