Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在http.js中无法读取store #25

Open
cdpv587 opened this issue Apr 28, 2018 · 5 comments
Open

在http.js中无法读取store #25

cdpv587 opened this issue Apr 28, 2018 · 5 comments

Comments

@cdpv587
Copy link

cdpv587 commented Apr 28, 2018

qq 20180428210751

@cdpv587
Copy link
Author

cdpv587 commented Apr 28, 2018

打印出来store是undefine 为什么呢? 麻烦指点一下

@superman66
Copy link
Owner

你在哪里存储登录成功后的返回值的呢?
我的项目中是这么写的:https://github.com/superman66/vue-axios-github/blob/master/src/login.vue#L29

@cdpv587
Copy link
Author

cdpv587 commented Apr 28, 2018

这无关于存储,我store这个引入是没有任何东西的,也就是说import 失败。
image

正常你打印出来应该是这样的

@superman66
Copy link
Owner

看错题目了。我看出 userToken 打印出来是 undefined。那得看你 store/index 是怎么初始化的。应该是初始化出现问题了

@cdpv587
Copy link
Author

cdpv587 commented May 2, 2018

image
image
import的顺序不同就会导致读取不出,第一个是错误的情况。请问一下这个顺序为什么会导致读取不出?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants