info.js 892 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { unref } from "vue";
  2. import { defineStore } from "pinia";
  3. import axios from "axios";
  4. import { useAxios } from "@vueuse/integrations/useAxios";
  5. const baseURL = import.meta.env.VITE_DOMAIN_URL;
  6. const instance = axios.create({
  7. baseURL: baseURL,
  8. });
  9. export const useInfoStore = defineStore({
  10. id: "info",
  11. state: () => {
  12. return {
  13. poster: [],
  14. exhibition: [],
  15. activity: [],
  16. news: [],
  17. notices: [],
  18. };
  19. },
  20. getters: {},
  21. actions: {
  22. async getPoster() {
  23. const { data } = useAxios(
  24. "/show/poster/getList",
  25. { method: "get" },
  26. instance
  27. );
  28. console.log("data", data);
  29. this.poster = data;
  30. },
  31. getData() {
  32. const { data, isFinished } = useAxios(
  33. "/show/poster/getList",
  34. { method: "get" },
  35. instance
  36. );
  37. },
  38. },
  39. });