12345678910111213141516171819202122232425 |
- import { buildingType } from "@/types";
- import { defineStore } from "pinia";
- export const useVideo = defineStore("model", {
- // 相当于data
- state: () => {
- return {
- currentBuild: {} as buildingType,
- buildList: [] as buildingType[],
- isVideo: false,
- isVideoHome: true,
- isShowBGM: true,
- };
- },
- // 相当于计算属性
- getters: {},
- // 相当于vuex的 mutation + action,可以同时写同步和异步的代码
- actions: {
- setCurrentBuild(building: buildingType) {
- this.currentBuild = building;
- },
- setBuildList(list: buildingType[]) {
- this.buildList = list;
- },
- },
- });
|