import { defineStore } from "pinia" import { reactive } from 'vue' export const useLoginUserStore = defineStore( "loginUser", () => { const loginUser = reactive({ user: {}, menu: [], }); // 设置当前登录用户 function setLoginUser(data) { loginUser.user = data; } // 设置当前登录用户菜单 function setLoginUserMenu(data) { loginUser.menu = data; } return { loginUser, setLoginUser, setLoginUserMenu, }; }, { unistorage: true, // 开启后对 state 的数据读写都将持久化 }, );