This commit is contained in:
2026-02-06 15:10:17 +08:00
commit f011de4ef4
59 changed files with 16075 additions and 0 deletions

20
src/stores/global.ts Normal file
View File

@@ -0,0 +1,20 @@
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useGlobalStore = defineStore('global', () => {
const state = ref({
loading: false,// 全局loading
view_loading: false,// 页面跳转loading
homeLeftNavCollapse: false,// 首页左侧导航是否折叠
})
const setLoading = (v: boolean) => { state.value.loading = v }
const setViewLoading = (v: boolean) => { state.value.view_loading = v }
const setHomeLeftNavCollapse = (v: boolean) => { state.value.homeLeftNavCollapse = v }
return {
state,
setLoading,
setViewLoading,
setHomeLeftNavCollapse
}
})

8
src/stores/index.ts Normal file
View File

@@ -0,0 +1,8 @@
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-persistedstate-plugin'
// 创建store实例
const store = createPinia()
// 使用持久化插件(全局持久化)
store.use(createPersistedState())
export default store
export * from './global'