templateAction.js 485 Bytes
import { defineStore } from 'pinia';

export const useTemplateActionStore = defineStore('templateAction', {
  state: () => ({
    // 只存这两个!!!
    replaceId: null,
    replaceType: null,
  }),

  actions: {
    // 设置待替换动作
    setReplaceAction(id, type) {
      this.replaceId = id;
      this.replaceType = type;
    },

    // 清空(用完就清)
    clearReplaceAction() {
      this.replaceId = null;
      this.replaceType = null;
    },
  },
});