inspectionValue.js 655 B

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