You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
700 B

import {acceptHMRUpdate, createPinia, defineStore} from 'pinia';
type menu = 'light' | 'dark'
export interface AppState {
menuTheme: menu;
bannerTitle: string;
}
const useAppStore = defineStore('app', {
state: (): AppState => ({
menuTheme: 'light',
bannerTitle: ''
}),
getters:{
getMenuTheme: (state)=> state.menuTheme,
getBannerTitle: (state)=> state.bannerTitle,
},
actions: {
setMenuTheme(type: menu = 'light'){
this.menuTheme = type;
},
setBannerTitle(title: string): void{
this.bannerTitle = title;
}
}
})
export default useAppStore;
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useAppStore, import.meta.hot))
}