/* * @Author: 李佐宁 * @Description: * @Date: 2023-03-09 10:13:44 * @LastEditTime: 2023-03-09 14:36:02 * @LastEditors: 李佐宁 */ import { defineStore } from "pinia"; import { store } from "../index"; interface State { loading: boolean; } export const useConfigStore = defineStore({ id: "app-config", state: (): State => ({ loading: false, // 页面loading }), getters: { getLoading(): boolean { return this.loading; }, }, actions: { setLoadState(state: boolean) { this.loading = state; }, }, }); // Need to be used outside the setup export function useConfigStoreWithOut() { return useConfigStore(store); }