0
我克隆了这个简单的管理仪表板到VueJs + AdminLTE项目到我的本地,到目前为止一切正常......但我目前正在努力找出如何从特别从vuex获得存储状态我修改为:如何从vuex获得内容
// if user loggedin
if(response.data && response.status == 200){
this.$store.commit("USERNAME", data.username)
this.$store.commit("TEL", data.tel)
this.$store.commit('EMAIL', data.email)
this.$router.push({ path: '/' })
}
页面重定向后,我试图获取用户名,电话,电子邮件但它不存在。
我做console.log(this.$store)
我看到很多内容,但不是用户信息
只有一个问题,为什么突变所需要的相应的用户信息?如果用户名突然更新可以vuex知道吗?像模型 – hidar
的直接数据绑定我们只能使用突变来更改状态值。 vuex有简单的文档https://vuex.vuejs.org/en/mutations.html –