feat: Add example-dialog demo

This commit is contained in:
kailong321200875
2022-02-19 13:17:38 +08:00
parent 41533c15e7
commit 262f4211cf
16 changed files with 311 additions and 24 deletions

View File

@@ -1,10 +1,13 @@
import { defineStore } from 'pinia'
import { store } from '../index'
import { useCache } from '@/hooks/web/useCache'
import { appModules } from '@/config/app'
import type { AppState, LayoutType, ThemeTypes } from '@/config/app'
import { setCssVar, humpToUnderline } from '@/utils'
import { ElMessage } from 'element-plus'
const { wsCache } = useCache()
export const useAppStore = defineStore({
id: 'app',
state: (): AppState => appModules,
@@ -119,6 +122,7 @@ export const useAppStore = defineStore({
return
}
this.layout = layout
wsCache.set('layout', this.layout)
},
setTitle(title: string) {
this.title = title
@@ -132,15 +136,18 @@ export const useAppStore = defineStore({
document.documentElement.classList.add('light')
document.documentElement.classList.remove('dark')
}
wsCache.set('isDark', this.isDark)
},
setCurrentSize(currentSize: ElememtPlusSzie) {
this.currentSize = currentSize
wsCache.set('currentSize', this.currentSize)
},
setMobile(mobile: boolean) {
this.mobile = mobile
},
setTheme(theme: ThemeTypes) {
this.theme = Object.assign(this.theme, theme)
wsCache.set('theme', this.theme)
},
setCssVarTheme() {
for (const key in this.theme) {

View File

@@ -1,8 +1,11 @@
import { defineStore } from 'pinia'
import { store } from '../index'
import { useCache } from '@/hooks/web/useCache'
import { localeModules, elLocaleMap } from '@/config/locale'
import type { LocaleState } from '@/config/locale'
const { wsCache } = useCache()
export const useLocaleStore = defineStore({
id: 'locales',
state: (): LocaleState => localeModules,
@@ -22,6 +25,7 @@ export const useLocaleStore = defineStore({
// this.locale = Object.assign(this.locale, localeMap)
this.currentLocale.lang = localeMap?.lang
this.currentLocale.elLocale = elLocaleMap[localeMap?.lang]
wsCache.set('lang', localeMap?.lang)
}
}
})