/* * @Author: shuishen 1109946754@qq.com * @Date: 2024-11-06 10:46:45 * @LastEditors: shuishen 1109946754@qq.com * @LastEditTime: 2024-11-07 18:58:32 * @FilePath: \bigScreen\src\store\router.js * @Description: * * Copyright (c) 2024 by shuishen, All Rights Reserved. */ // src/stores/useUserStore.js import { defineStore } from 'pinia' export const useRouterStore = defineStore('useRouterStore', { // 存储状态的地方,相当于 Vuex 的 state state: () => ({ loadSub: false, loadSingle: false, }), // 相当于 Vuex 的 getters,用于计算状态 getters: { }, // 相当于 Vuex 的 mutations 和 actions,用于同步或异步地修改状态 actions: { setLoadSub (flag) { this.loadSub = flag }, setLoadSingle (flag) { this.loadSingle = flag }, }, persist: { enabled: true, strategies: [ { key: 'loadSub', paths: ['loadSub'], storage: localStorage, }, { key: 'loadSingle', paths: ['loadSingle'], storage: localStorage, }, ] } })