接入前端P0页面真实接口
This commit is contained in:
19
client/src/stores/appPreferences.ts
Normal file
19
client/src/stores/appPreferences.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export type SupportedLocale = 'zh-CN' | 'en-US'
|
||||
|
||||
export const useAppPreferencesStore = defineStore('appPreferences', {
|
||||
state: () => ({
|
||||
locale: 'zh-CN' as SupportedLocale,
|
||||
darkMode: false,
|
||||
}),
|
||||
actions: {
|
||||
setLocale(locale: SupportedLocale) {
|
||||
this.locale = locale
|
||||
},
|
||||
toggleTheme() {
|
||||
this.darkMode = !this.darkMode
|
||||
document.documentElement.classList.toggle('app-theme-dark', this.darkMode)
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user