18 lines
400 B
JavaScript
Raw Permalink Normal View History

2025-04-28 15:37:57 +08:00
import { defineStore } from 'pinia'
2025-10-10 11:25:54 +08:00
import { ref } from "vue";
2025-04-28 15:37:57 +08:00
2025-10-10 11:25:54 +08:00
export const useScanCodeStore = defineStore('scancode', () => {
const type = ref('');
const code = ref([]);
const clearCode = (data) => {
type.value = '';
code.value = [];
2025-04-28 15:37:57 +08:00
}
2025-10-10 11:25:54 +08:00
const addCode = (data, intype) => {
2025-04-28 15:37:57 +08:00
type.value = intype;
code.value.push(data);
}
2025-10-10 11:25:54 +08:00
return { code, type, clearCode, addCode };
}, {
2025-04-28 15:37:57 +08:00
persist: true
})