2023-11-24 11:02:52 +00:00
|
|
|
import { defineStore } from 'pinia'
|
|
|
|
|
|
2024-04-10 06:16:56 +00:00
|
|
|
export interface commonTypes {
|
|
|
|
|
breadcrumb: any
|
|
|
|
|
paginationConfig: any | null
|
|
|
|
|
search: any
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-24 11:02:52 +00:00
|
|
|
const useCommonStore = defineStore({
|
|
|
|
|
id: 'common',
|
2024-04-10 06:16:56 +00:00
|
|
|
state: (): commonTypes => ({
|
|
|
|
|
breadcrumb: null,
|
|
|
|
|
// 搜索和分页缓存
|
|
|
|
|
paginationConfig: {},
|
|
|
|
|
search: {}
|
2023-11-24 11:02:52 +00:00
|
|
|
}),
|
|
|
|
|
actions: {
|
2023-12-04 03:18:12 +00:00
|
|
|
saveBreadcrumb(data: any) {
|
2023-11-24 11:02:52 +00:00
|
|
|
this.breadcrumb = data
|
2024-04-10 06:16:56 +00:00
|
|
|
},
|
|
|
|
|
savePage(val: string, data: any) {
|
|
|
|
|
this.paginationConfig[val] = data
|
|
|
|
|
},
|
|
|
|
|
saveCondition(val: string, data: any) {
|
|
|
|
|
this.search[val] = data
|
2023-11-24 11:02:52 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default useCommonStore
|