// stores/counter.js import { defineStore } from "pinia"; import * as shopApi from "@/http/api/shop.js"; // 分销 export const useAccountInfoStore = defineStore("accountInfo", { state: () => { return { shopInfo: {}, }; }, actions: { getShopInfo() { return shopApi.getShopInfo().then((res) => { this.shopInfo = res; return this.shopInfo; }); }, editShopInfo(data,autoRefresh = true) { return shopApi.editShopInfo(data).then((res) => { if(autoRefresh) { this.getShopInfo() } return res }); }, }, unistorage: true, // 开启后对 state 的数据读写都将持久化 });