首页 > 技术文章 > vue无法获取$store中的变量

ticlab 2021-09-29 09:51 原文

需求是向后端传登陆用户的ID,写成this.$store.user.userID

结果后端没收到,原来是少写了一个state

改为this.$store.state.user.userID后正常。

推荐阅读