45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
|
|
import { defineStore } from 'pinia';
|
||
|
|
import { parse, stringify } from 'zipson';
|
||
|
|
|
||
|
|
const examMsgActiveStore = defineStore('examMsg', {
|
||
|
|
state: () => ({
|
||
|
|
// 持久化数据
|
||
|
|
activeIndex: "1",
|
||
|
|
offset: 1,
|
||
|
|
limit: 10,
|
||
|
|
dataCount: 0,
|
||
|
|
pageCount: 0,
|
||
|
|
searchOptions: {
|
||
|
|
uid: "",
|
||
|
|
exam_name: "",
|
||
|
|
status: "",
|
||
|
|
application_end: "",
|
||
|
|
exam_start: "",
|
||
|
|
exam_end: "",
|
||
|
|
},
|
||
|
|
sortOptions: {
|
||
|
|
application_end: false,
|
||
|
|
exam_start: false,
|
||
|
|
exam_end: false,
|
||
|
|
},
|
||
|
|
dialogSearchVisible: false,
|
||
|
|
dialogSortVisible: false,
|
||
|
|
dialogOperationVisible: false
|
||
|
|
}),
|
||
|
|
persist: {
|
||
|
|
enabled: true, // Store 中数据持久化生效
|
||
|
|
strategies: [
|
||
|
|
{
|
||
|
|
key: 'examMsgActive', // 存储的 key
|
||
|
|
storage: localStorage, // 存储位置
|
||
|
|
paths: ["activeIndex", "offset", "limit", "dataCount", "pageCount", "searchOptions", "sortOptions", "dialogSearchVisible", "dialogSortVisible", "dialogOperationVisible"], // 需要持久化的字段
|
||
|
|
serializer: {
|
||
|
|
deserialize: parse,
|
||
|
|
serialize: stringify,
|
||
|
|
},
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
export default examMsgActiveStore;
|