货无忧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
804 B

// 系统设置数据储存仓库
import {
defineStore
} from 'pinia';
import {
reactive,
ref,
shallowRef
} from 'vue';
export const useSystemSettingsStore = defineStore('useSystemSettingsStore', () => {
/**
* 扫描后台监听状态数组
*/
const scanStateList = reactive([{
title: '关闭',
value: 0
}, {
title: '开启',
value: 1
}, ])
/**
* 扫描后台监听状态
*/
const scanState = ref(uni.getStorageSync('scanState') || 0)
/**
* 后台扫描监听状态
*/
const HANDLE_SCANSTATE = (index) => {
scanState.value = scanStateList[index].value
// 将设置的值存入本地
uni.setStorageSync('scanState', scanState.value)
}
return {
scanStateList,
scanState,
HANDLE_SCANSTATE
}
})
// 暴露仓库实例
export default useSystemSettingsStore