引入store存放检测设备的相关信息
This commit is contained in:
@@ -17,3 +17,5 @@ export const USER_STORE_KEY = "cn-user";
|
||||
// pinia中dict store的key
|
||||
export const DICT_STORE_KEY = "cn-dictData";
|
||||
|
||||
export const CHECK_STORE_KEY = "cn-check";
|
||||
|
||||
|
||||
24
frontend/src/stores/modules/check.ts
Normal file
24
frontend/src/stores/modules/check.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {CHECK_STORE_KEY} from "@/stores/constant";
|
||||
import type {CheckData} from "@/api/check/interface";
|
||||
|
||||
|
||||
export const useCheckStore = defineStore("check", {
|
||||
id: CHECK_STORE_KEY,
|
||||
|
||||
state: () => ({
|
||||
devices: Array<CheckData.Device>()
|
||||
}),
|
||||
|
||||
getters: {},
|
||||
|
||||
actions: {
|
||||
addDevices(device: CheckData.Device[]) {
|
||||
this.devices.push(...device);
|
||||
},
|
||||
|
||||
clearDevices() {
|
||||
this.devices = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user