import { defineStore } from "pinia"; const xunJianStore = defineStore("xunJian", { state: () => ({ planTabs: 0, //巡检计划页 tabs切换值 siteId: null, //巡检计划页 站点id planSonId: null, //巡检计划页 子计划id planSonId1: null, //巡检计划页 子计划id siteNubmber: null, //巡检计划页 站点号码 siteStatus: null, //巡检详情页 定位状态 contentArray: {}, collectDataList: [], //巡检采集 }), persist: { // 自定义数据持久化方式 // key: 'store-key', 指定key进行存储,此时非key的值不会持久化,刷新就会丢失 storage: window ? window.localStorage : uni.setStorageSync(), // 指定换成地址 // paths: ['nested.data'],// 指定需要持久化的state的路径名称 beforeRestore: (context) => { console.log("Before" + context); }, afterRestore: (context) => { console.log("After" + context); }, }, actions: {}, }); export default xunJianStore;