/**
 *  动态页面 表单数据缓存
 */
import { defineStore } from 'pinia'

export const DataStore = defineStore('DataStore', {
  state: () => ({
    container: <any>{},
  }),

  actions: {
    set({page_code, container_code,  data, }:any){
      if(!this.container[page_code]){
        this.container[page_code] = {}
      }
      Object.assign(this.container[page_code], {
        [container_code] : data
      })
    },
    get({page_code, container_code,}:any){
      return this.container[page_code][container_code]
    },
    clear(){
      this.container = {}
    }
  }
})
