Ben Lin
2025-03-08 745815f637e5385b2cbc23a6ae02401bb8b6c675
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
40
41
42
43
44
45
/*
 * @Description: 低代码Store
 * @Author: Ben Lin
 * @version:
 * @Date: 2024-06-18 15:09:47
 * @LastEditors: Ben Lin
 * @LastEditTime: 2024-10-23 22:52:45
 */
import { defineStore } from 'pinia';
import { store } from '@/store';
 
interface LowCodeState {
  isSearch: { [key: string]: any };
  curCPInfo: any[];
}
 
export const useLowCodeStore = defineStore({
  id: 'app-LowCode',
  state: (): LowCodeState => ({
    isSearch: {},
    curCPInfo: [],
  }),
  getters: {
    getIsSearch(state): { [key: string]: any } {
      return state.isSearch;
    },
    getCurCPInfo(state): any[] {
      return state.curCPInfo;
    },
  },
  actions: {
    setIsSearch(val: { [key: string]: any }) {
      this.isSearch = val;
    },
    resetState() {
      this.isSearch = {};
      this.curCPInfo = [];
    },
  },
});
 
// Need to be used outside the setup
export function useQueryWithOut() {
  return useLowCodeStore(store);
}