export const useStore = defineStore('myInfo', {
    state: () => {
        return {
            userName: '99'
        }
    },
    getters: {
        textConbain: (state) => state.userName + '4444',
        textEnd() {
            return this.textConbain + '666'
        }
    },
    actions: {
        updateText() {
            console.log('updateText')
        }
    },
    persist: {
        enabled: true, // 开启数据缓存
        strategies: [
            {
                // 自定义存储的 key，默认是 store.$id
                key: 'userName',
                storage: sessionStorage, //缓存模式 可选 localStorage sessionStorage
                // state 中的字段名，按组打包储存
                paths: ['userName'] //需要缓存的字段 与 state中相关联
            }
        ]
    }
})
