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