index.js 738 Bytes
import { defineStore } from 'pinia';

export const mainStore = defineStore('main', {
  state: () => {
    return {
      msg: 'Hello world',
      count: 0,
      auth: false,
      comment_num: 0,
      video_detail: {},
      scrollTop: 0,
      scrollTopCollection: 0,
      scrollTopLike: 0,
    };
  },
  getters: {},
  actions: {
    changeState (state) {
      this.auth = state;
    },
    changeCommentNum (num) {
      this.comment_num = num;
    },
    changeVideoDetail (v) {
      this.video_detail = v;
    },
    changeScrollTop (v) {
      this.scrollTop = v;
    },
    changeScrollTopCollection (v) {
      this.scrollTopCollection = v;
    },
    changeScrollTopLike (v) {
      this.scrollTopLike = v;
    },
  },
});