You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
787 B

3 weeks ago
3 weeks ago
  1. /** @format */
  2. import { defineStore } from "pinia";
  3. import { ref } from "vue";
  4. // 定义 Store
  5. export const useMarketSituationStore = defineStore(
  6. "marketSituation",
  7. () => {
  8. const cardData = ref([]);
  9. const gloablCardData = ref([]);
  10. const marketDetailCardData = ref([]);
  11. const countryMarketCardData = ref([]);
  12. // 记得 return
  13. return {
  14. cardData,
  15. gloablCardData,
  16. marketDetailCardData,
  17. countryMarketCardData,
  18. };
  19. },
  20. // TODO: 持久化
  21. {
  22. // 网页端持久化
  23. // persist: true,
  24. // 小程序端持久化
  25. persist: {
  26. storage: {
  27. getItem(key) {
  28. return uni.getStorageSync(key);
  29. },
  30. setItem(key, value) {
  31. uni.setStorageSync(key, value);
  32. },
  33. },
  34. },
  35. }
  36. );