import { defineStore } from 'pinia' import { ref } from 'vue' // 定义 Store export const useDeepExplorationStore = defineStore( 'deepExploration', () => { // 会员信息 const deepExplorationInfo = ref() // 保存会员信息,登录时使用 const setDeepExplorationInfo = (val) => { deepExplorationInfo.value = val } // 清理会员信息,退出时使用 const clearDeepExplorationInfo = () => { deepExplorationInfo.value = undefined } // 记得 return return { deepExplorationInfo, setDeepExplorationInfo, clearDeepExplorationInfo, } }, // TODO: 持久化 { // 网页端持久化 // persist: true, // 小程序端持久化 persist: { storage: { getItem(key) { return uni.getStorageSync(key) }, setItem(key, value) { uni.setStorageSync(key, value) }, }, }, }, )