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

请教一下,我用的vuex,第一次打开页面的时候,查看页面源代码,里边window__initial__state 都为空 #14

Open
zhaoxiaoer888 opened this issue Aug 28, 2018 · 4 comments

Comments

@zhaoxiaoer888
Copy link

页面html代码,有数据的地方也全部是 这个

@zhaoxiaoer888
Copy link
Author

image

@zhaoxiaoer888
Copy link
Author

看了老大。我首页走的asyncData方法请求,浏览器中直接输入的url,第一次还是为空,这个怎么解决;另外其他页面也遇到了刷新之后 不执行asyncData这个方法,跪求解答

@lincenying
Copy link
Owner

在asyncData方法里加个console, 看node有没有执行,
也可以在

Promise.all(
                matchedComponents.map(
                    ({ asyncData }) => {
                        console.log(asyncData)
                        asyncData &&
                        asyncData({
                            store,
                            route: router.currentRoute,
                            cookies: context.cookies,
                            isServer: true,
                            isClient: false
                        })
                        }
                )
            )

看看打印出什么

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