qvt-cli
Version:
提供多端响应式设计的模板框架
38 lines (33 loc) • 678 B
text/typescript
import { defineStore } from 'pinia';
import { ref } from 'vue';
const initState = {
host: '',
bedsideSN: '',
boardSN: '',
};
export const usePublicStore = defineStore(
'public',
() => {
const publicInfo = ref<any>({ ...initState });
const getSN = (type: 'bedside' | 'board') => {
return type === 'bedside'
? publicInfo.value.bedsideSN
: publicInfo.value.boardSN;
};
const setPublic = (val: any) => {
publicInfo.value = val;
};
const getPublic = () => {
return publicInfo.value;
};
return {
publicInfo,
getPublic,
setPublic,
getSN,
};
},
{
persist: true,
},
);