vuex状态管理的问题

有两个组件login和header 我在login里进行请求获取到的数据 提交mutation 数据如下图
图片描述

这是login里的代码
system.login(params).then((res) => {

                if(res.code == '200') {
                    if(this.queryUrl.returnUrl != null ) {
                        this.$router.push(this.queryUrl.returnUrl)
                    }else {
                         console.log(res.data)
                         this.setLoginInfo(res.data)
                        //this.$router.push('/account/overview')
                    }
                }else {
                    this.isPhone = true
                    this.fontVal = res.msg
                }
            })

// 提交mutations

    ...mapMutations({
        setLoginInfo: 'SET_LOGININFO'
    })
            

然后在header里获取
computed: {

...mapGetters([
     'loginInfo'
])

}
通过console.log打印出来的是这样的 这是什么鬼 没有获取到我想要的数据
图片描述

阅读 1.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题