Files
tqxz-sn-message-platform/src/stores/historyMsg.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-03-27 17:45:41 +08:00
import { defineStore } from 'pinia';
import { parse, stringify } from 'zipson';
const historyMsgActiveStore = defineStore('historyMsg', {
state: () => ({
// 持久化数据
activeIndex: "1",
subActiveIndex: "1",
offset: 1,
limit: 10,
dataCount: 0,
pageCount: 0,
searchOptions: {
sn_number: "",
original_msg: "",
msg_data: "",
created_at: "",
},
sortOptions: {
sn_number: false,
created_at: false,
},
dialogSearchVisible: false,
dialogSortVisible: false,
dialogOperationVisible: false
}),
persist: {
enabled: true, // Store 中数据持久化生效
strategies: [
{
key: 'historyMsgActive', // 存储的 key
storage: localStorage, // 存储位置
paths: ["activeIndex", "subActiveIndex", "offset", "limit", "dataCount", "pageCount", "searchOptions", "sortOptions", "dialogSearchVisible", "dialogSortVisible", "dialogOperationVisible"], // 需要持久化的字段
serializer: {
deserialize: parse,
serialize: stringify,
},
}
]
},
});
export default historyMsgActiveStore;