|
@@ -3,6 +3,7 @@ import { store } from '../index'
|
|
import { useCache } from '@/hooks/web/useCache'
|
|
import { useCache } from '@/hooks/web/useCache'
|
|
import { appModules } from '@/config/app'
|
|
import { appModules } from '@/config/app'
|
|
import type { AppState, LayoutType } from '@/config/app'
|
|
import type { AppState, LayoutType } from '@/config/app'
|
|
|
|
+import { setCssVar, humpToUnderline } from '@/utils'
|
|
|
|
|
|
const { wsCache } = useCache()
|
|
const { wsCache } = useCache()
|
|
|
|
|
|
@@ -10,35 +11,39 @@ export const useAppStore = defineStore({
|
|
id: 'app',
|
|
id: 'app',
|
|
state: (): AppState => appModules,
|
|
state: (): AppState => appModules,
|
|
getters: {
|
|
getters: {
|
|
|
|
+ getBreadcrumb(): boolean {
|
|
|
|
+ return this.breadcrumb
|
|
|
|
+ },
|
|
|
|
+ getBreadcrumbIcon(): boolean {
|
|
|
|
+ return this.breadcrumbIcon
|
|
|
|
+ },
|
|
getCollapse(): boolean {
|
|
getCollapse(): boolean {
|
|
return this.collapse
|
|
return this.collapse
|
|
},
|
|
},
|
|
- getShowLogo(): boolean {
|
|
|
|
- return this.showLogo
|
|
|
|
- },
|
|
|
|
- getShowTags(): boolean {
|
|
|
|
- return this.showTags
|
|
|
|
|
|
+ getHamburger(): boolean {
|
|
|
|
+ return this.hamburger
|
|
},
|
|
},
|
|
- getShowNavbar(): boolean {
|
|
|
|
- return this.showNavbar
|
|
|
|
|
|
+ getScreenfull(): boolean {
|
|
|
|
+ return this.screenfull
|
|
},
|
|
},
|
|
- getFixedHeader(): boolean {
|
|
|
|
- return this.fixedHeader
|
|
|
|
|
|
+ getSize(): boolean {
|
|
|
|
+ return this.size
|
|
},
|
|
},
|
|
- getLayout(): LayoutType {
|
|
|
|
- return this.layout
|
|
|
|
|
|
+ getLocale(): boolean {
|
|
|
|
+ return this.locale
|
|
},
|
|
},
|
|
- getShowBreadcrumb(): boolean {
|
|
|
|
- return this.showBreadcrumb
|
|
|
|
|
|
+ getTagsView(): boolean {
|
|
|
|
+ return this.tagsView
|
|
},
|
|
},
|
|
- getShowHamburger(): boolean {
|
|
|
|
- return this.showHamburger
|
|
|
|
|
|
+ getLogo(): boolean {
|
|
|
|
+ return this.logo
|
|
},
|
|
},
|
|
- getShowScreenfull(): boolean {
|
|
|
|
- return this.showScreenfull
|
|
|
|
|
|
+ getGreyMode(): boolean {
|
|
|
|
+ return this.greyMode
|
|
},
|
|
},
|
|
- getShowUserInfo(): boolean {
|
|
|
|
- return this.showUserInfo
|
|
|
|
|
|
+
|
|
|
|
+ getLayout(): LayoutType {
|
|
|
|
+ return this.layout
|
|
},
|
|
},
|
|
getTitle(): string {
|
|
getTitle(): string {
|
|
return this.title
|
|
return this.title
|
|
@@ -49,58 +54,56 @@ export const useAppStore = defineStore({
|
|
getUserInfo(): string {
|
|
getUserInfo(): string {
|
|
return this.userInfo
|
|
return this.userInfo
|
|
},
|
|
},
|
|
- getGreyMode(): boolean {
|
|
|
|
- return this.greyMode
|
|
|
|
- },
|
|
|
|
- getShowBackTop(): boolean {
|
|
|
|
- return this.showBackTop
|
|
|
|
- },
|
|
|
|
- getShowMenuTab(): boolean {
|
|
|
|
- return this.showMenuTab
|
|
|
|
- },
|
|
|
|
getIsDark(): boolean {
|
|
getIsDark(): boolean {
|
|
return this.isDark
|
|
return this.isDark
|
|
},
|
|
},
|
|
- getSize(): ElememtPlusSzie {
|
|
|
|
- return this.size
|
|
|
|
|
|
+ getCurrentSize(): ElememtPlusSzie {
|
|
|
|
+ return this.currentSize
|
|
},
|
|
},
|
|
getSizeMap(): ElememtPlusSzie[] {
|
|
getSizeMap(): ElememtPlusSzie[] {
|
|
return this.sizeMap
|
|
return this.sizeMap
|
|
},
|
|
},
|
|
getMobile(): boolean {
|
|
getMobile(): boolean {
|
|
return this.mobile
|
|
return this.mobile
|
|
|
|
+ },
|
|
|
|
+ getTheme(): Recordable {
|
|
|
|
+ return this.theme
|
|
}
|
|
}
|
|
},
|
|
},
|
|
actions: {
|
|
actions: {
|
|
|
|
+ setBreadcrumb(breadcrumb: boolean) {
|
|
|
|
+ this.breadcrumb = breadcrumb
|
|
|
|
+ },
|
|
|
|
+ setBreadcrumbIcon(breadcrumbIcon: boolean) {
|
|
|
|
+ this.breadcrumbIcon = breadcrumbIcon
|
|
|
|
+ },
|
|
setCollapse(collapse: boolean) {
|
|
setCollapse(collapse: boolean) {
|
|
this.collapse = collapse
|
|
this.collapse = collapse
|
|
},
|
|
},
|
|
- setShowLogo(showLogo: boolean) {
|
|
|
|
- this.showLogo = showLogo
|
|
|
|
- },
|
|
|
|
- setShowTags(showTags: boolean) {
|
|
|
|
- this.showTags = showTags
|
|
|
|
|
|
+ setHamburger(hamburger: boolean) {
|
|
|
|
+ this.hamburger = hamburger
|
|
},
|
|
},
|
|
- setShowNavbar(showNavbar: boolean) {
|
|
|
|
- this.showNavbar = showNavbar
|
|
|
|
|
|
+ setScreenfull(screenfull: boolean) {
|
|
|
|
+ this.screenfull = screenfull
|
|
},
|
|
},
|
|
- setFixedHeader(fixedHeader: boolean) {
|
|
|
|
- this.fixedHeader = fixedHeader
|
|
|
|
|
|
+ setSize(size: boolean) {
|
|
|
|
+ this.size = size
|
|
},
|
|
},
|
|
- setLayout(layout: LayoutType) {
|
|
|
|
- this.layout = layout
|
|
|
|
|
|
+ setLocale(locale: boolean) {
|
|
|
|
+ this.locale = locale
|
|
},
|
|
},
|
|
- setBreadcrumb(showBreadcrumb: boolean) {
|
|
|
|
- this.showBreadcrumb = showBreadcrumb
|
|
|
|
|
|
+ setTagsView(tagsView: boolean) {
|
|
|
|
+ this.tagsView = tagsView
|
|
},
|
|
},
|
|
- setHamburger(showHamburger: boolean) {
|
|
|
|
- this.showHamburger = showHamburger
|
|
|
|
|
|
+ setLogo(logo: boolean) {
|
|
|
|
+ this.logo = logo
|
|
},
|
|
},
|
|
- setScreenfull(showScreenfull: boolean) {
|
|
|
|
- this.showScreenfull = showScreenfull
|
|
|
|
|
|
+ setGreyMode(greyMode: boolean) {
|
|
|
|
+ this.greyMode = greyMode
|
|
},
|
|
},
|
|
- setUserInfo(showUserInfo: boolean) {
|
|
|
|
- this.showUserInfo = showUserInfo
|
|
|
|
|
|
+
|
|
|
|
+ setLayout(layout: LayoutType) {
|
|
|
|
+ this.layout = layout
|
|
},
|
|
},
|
|
setTitle(title: string) {
|
|
setTitle(title: string) {
|
|
this.title = title
|
|
this.title = title
|
|
@@ -108,15 +111,6 @@ export const useAppStore = defineStore({
|
|
setLogoTitle(logoTitle: string) {
|
|
setLogoTitle(logoTitle: string) {
|
|
this.logoTitle = logoTitle
|
|
this.logoTitle = logoTitle
|
|
},
|
|
},
|
|
- setGreyMode(greyMode: boolean) {
|
|
|
|
- this.greyMode = greyMode
|
|
|
|
- },
|
|
|
|
- setShowBackTop(showBackTop: boolean) {
|
|
|
|
- this.showBackTop = showBackTop
|
|
|
|
- },
|
|
|
|
- setShowMenuTab(showMenuTab: boolean) {
|
|
|
|
- this.showMenuTab = showMenuTab
|
|
|
|
- },
|
|
|
|
setIsDark(isDark: boolean) {
|
|
setIsDark(isDark: boolean) {
|
|
this.isDark = isDark
|
|
this.isDark = isDark
|
|
if (this.isDark) {
|
|
if (this.isDark) {
|
|
@@ -128,12 +122,21 @@ export const useAppStore = defineStore({
|
|
}
|
|
}
|
|
wsCache.set('isDark', this.isDark)
|
|
wsCache.set('isDark', this.isDark)
|
|
},
|
|
},
|
|
- setSize(size: ElememtPlusSzie) {
|
|
|
|
- this.size = size
|
|
|
|
- wsCache.set('size', this.size)
|
|
|
|
|
|
+ setCurrentSize(currentSize: ElememtPlusSzie) {
|
|
|
|
+ this.currentSize = currentSize
|
|
|
|
+ wsCache.set('currentSize', this.currentSize)
|
|
},
|
|
},
|
|
setMobile(mobile: boolean) {
|
|
setMobile(mobile: boolean) {
|
|
this.mobile = mobile
|
|
this.mobile = mobile
|
|
|
|
+ },
|
|
|
|
+ setTheme(theme: Recordable) {
|
|
|
|
+ this.theme = Object.assign(this.theme, theme)
|
|
|
|
+ wsCache.set('theme', this.theme)
|
|
|
|
+ },
|
|
|
|
+ setCssVarTheme() {
|
|
|
|
+ for (const key in this.theme) {
|
|
|
|
+ setCssVar(`--${humpToUnderline(key)}`, this.theme[key])
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|