release: v3 release test

This commit is contained in:
kailong321200875
2022-02-19 09:46:33 +08:00
parent f4eb4eac3a
commit f283478c5b
8 changed files with 63 additions and 139 deletions

View File

@@ -1,8 +1,11 @@
import type { App } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'
const store = createPinia()
store.use(piniaPluginPersist)
export const setupStore = (app: App<Element>) => {
app.use(store)
}

View File

@@ -1,16 +1,16 @@
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,
persist: {
enabled: true
},
getters: {
getBreadcrumb(): boolean {
return this.breadcrumb
@@ -119,7 +119,6 @@ export const useAppStore = defineStore({
return
}
this.layout = layout
wsCache.set('layout', this.layout)
},
setTitle(title: string) {
this.title = title
@@ -133,18 +132,15 @@ 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,14 +1,14 @@
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,
persist: {
enabled: true
},
getters: {
getCurrentLocale(): LocaleDropdownType {
return this.currentLocale
@@ -22,7 +22,6 @@ 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)
}
}
})

View File

@@ -26,6 +26,9 @@ export const usePermissionStore = defineStore({
isAddRouters: false,
menuTabRouters: []
}),
persist: {
enabled: true
},
getters: {
getRouters(): AppRouteRecordRaw[] {
return this.routers

View File

@@ -16,6 +16,9 @@ export const useTagsViewStore = defineStore({
visitedViews: [],
cachedViews: new Set()
}),
persist: {
enabled: true
},
getters: {
getVisitedViews(): RouteLocationNormalizedLoaded[] {
return this.visitedViews