12345678910111213141516171819202122232425262728293031323334 |
- import { defineStore } from "pinia"
- import { reactive } from 'vue'
- export const useHandlerStore = defineStore(
- "handler",
- () => {
- const handler = reactive({
- data: null,
- type: '',
- });
- // 保存事件信息
- function setHandlerData(data, type) {
- handler.data = data;
- handler.type = type;
- }
-
- // 清空事件信息
- function clearHandlerData() {
- console.log(handler.data)
- handler.data = null;
- handler.type = '';
- }
- return {
- handler,
- setHandlerData,
- clearHandlerData,
- };
- },
- {
- unistorage: true, // 开启后对 state 的数据读写都将持久化
- },
- );
|