incidentBuild.js 719 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineStore } from "pinia"
  2. import { reactive } from 'vue'
  3. export const useIncidentBuildStore = defineStore(
  4. "incidentBuild",
  5. () => {
  6. const incidentBuild = reactive({
  7. data: null,
  8. type: '',
  9. });
  10. // 保存
  11. function setIncidentBuildData(data, type) {
  12. incidentBuild.data = data;
  13. incidentBuild.type = type;
  14. }
  15. // 清空
  16. function clearIncidentBuildData() {
  17. console.log(incidentBuild.data)
  18. incidentBuild.data = null;
  19. incidentBuild.type = '';
  20. }
  21. return {
  22. incidentBuild,
  23. setIncidentBuildData,
  24. clearIncidentBuildData,
  25. };
  26. },
  27. {
  28. unistorage: true, // 开启后对 state 的数据读写都将持久化
  29. },
  30. );