深色模式

深色模式

自动切换深色模式

Vue+Vuetify为例

import { useTheme } from 'vuetify';
const theme = useTheme()

onMounted(async ()=>{
  const appWindow = getCurrentWindow()
  const systemTheme = await appWindow.theme();
  theme.change(systemTheme || 'light')
  await appWindow.listen('tauri://theme-changed', (event) => {
    theme.change(event.payload as string)
  })
})