有两个组件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打印出来的是这样的 这是什么鬼 没有获取到我想要的数据