Sanakey
3 天以前 b5c1614fe473330ceca8b7cff0f1802e19bd5039
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
import { defineStore } from 'pinia';
import { store } from '@/store';
 
import {getSelectInfoApi} from "@/api/base/data";
 
 
export const useFormBaseData = defineStore({
  id: 'form-base-data',
  state: () => ({
    baseData:{}
  }),
  getters: {
    getFormBaseData(state) {
      return state.baseData  || {};
    },
  },
  actions: {
    /**
     * @description: logout
     */
    async getSelectInfoAction () {
      try {
        let res = await getSelectInfoApi({})
        Logger.log('getSelectInfoApi...',res);
        this.baseData = res?.data || {};
      } catch (e) {
        Logger.error(e);
      } finally {
      }
    },
 
  },
});
 
// Need to be used outside the setup
export function useFormBaseDataWithOut() {
  return useFormBaseData(store);
}