/*
|
* @Author: shuishen 1109946754@qq.com
|
* @Date: 2024-10-25 11:35:36
|
* @LastEditors: shuishen 1109946754@qq.com
|
* @LastEditTime: 2024-10-28 18:22:32
|
* @FilePath: \bigScreen\src\store\modules\appStore.js
|
* @Description:
|
*
|
* Copyright (c) 2024 by shuishen, All Rights Reserved.
|
*/
|
import { defineStore } from 'pinia'
|
import { ref } from 'vue'
|
const useAppStore = defineStore(
|
'appStore',
|
() => {
|
let loadNum = ref(0)
|
let loadMap = false
|
|
|
const hideLoading = () => {
|
loadNum.value--
|
}
|
const showLoading = () => {
|
loadNum.value++
|
}
|
const isLoading = () => {
|
return loadNum.value > 0
|
}
|
|
const setLoadMap = (flag) => {
|
loadMap = flag
|
}
|
|
const getLoadMap = () => {
|
return loadMap == true
|
}
|
|
return {
|
hideLoading,
|
showLoading,
|
isLoading,
|
setLoadMap,
|
getLoadMap
|
// loadNum要持久化保存到本地一定要加,当然不加数据响应是没问题的,isLoading也会重新计算,就是不会保存
|
}
|
}
|
//作为第三个参数配置
|
// {
|
// persist: {
|
// enabled: true,
|
// strategies: [{storage: localStorage, paths: ['loadNum']}]
|
// }
|
// }
|
)
|
|
export default useAppStore
|