forked from next-dev-team/nuxt3-element-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.ts
27 lines (23 loc) · 793 Bytes
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { defineStore } from 'pinia'
import { devMenu } from '../constants'
type ITheme = 'theme.tailwind' | 'theme.plugin'
type IIcons = 'icon.carbon'
type IComponents = 'com.next-dev' | 'com.headless'
export type AppState = {
toolboxModal?: boolean
activeDevMenu: { title: string; icon?: string; iframeUrl?: string; disabled?: boolean; render?: ITheme | IComponents | IIcons }
}
export const useAppStore = defineStore('useAppStore', {
state: (): AppState => ({
toolboxModal: false,
activeDevMenu: devMenu?.[0]?.children?.[0] as AppState['activeDevMenu'],
}),
actions: {
toggleToolboxModal() {
this.toolboxModal = !this.toolboxModal
},
setActiveDevMenu(activeDevMenu: AppState['activeDevMenu']) {
this.activeDevMenu = activeDevMenu
},
},
})