video.js 587 B

123456789101112131415161718192021222324252627
  1. import { defineStore } from "pinia";
  2. import { VIDEO_LISTS } from "@/api";
  3. const state = () => ({
  4. list: []
  5. })
  6. export const useVideoStore = defineStore('video', {
  7. state,
  8. getters: {
  9. getVideoList() {
  10. return this.list
  11. }
  12. },
  13. actions: {
  14. async setVideoList(isLoading) {
  15. try {
  16. const res = await VIDEO_LISTS({ limit: 10, active_id: 0, isLoading });
  17. const { data: { video_list = [] } } = res;
  18. this.list = [...this.list, ...video_list];
  19. } catch (error) { }
  20. },
  21. setList(item, index) {
  22. this.list[index] = item;
  23. }
  24. }
  25. })