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

use async code in beforeRouteEnter hook,it throw some error #3029

Closed
ytudt opened this issue Mar 15, 2018 · 6 comments
Closed

use async code in beforeRouteEnter hook,it throw some error #3029

ytudt opened this issue Mar 15, 2018 · 6 comments
Labels

Comments

@ytudt
Copy link

ytudt commented Mar 15, 2018

This question is available on Nuxt.js community (#c2627)
@ytudt
Copy link
Author

ytudt commented Mar 15, 2018

i fetch date in beforeRouteEnter,when and 'next()' when date is back.like below
beforeRouteEnter(to, from, next) {
axios.get(https://kf.dianping.com/api/relations/listRecommendRelation,{
params: {
bu: '美食',
orderType: 'dealOrder',
orderId: 4252500185,
orderIdStr: "4252500185",
userId: 787514285,
subSource: "MT_APP",
visitId: "480e6383-a8f7-40fb-b00c-bf85a1f16f6b"
}
})
.then((res) => {
next();
});
},

then vue warn like 'vue.runtime.esm.js:587 [Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside

, or missing . Bailing hydration and performing full client-side render.'
what shoule i do?

@husayt
Copy link
Contributor

husayt commented Mar 15, 2018

There is not enough detail here to be able to help you and also it is not really clear. The problem is not in the code you shared, but somewhere else.

@husayt husayt closed this as completed Mar 15, 2018
@ytudt
Copy link
Author

ytudt commented Mar 17, 2018

when i use async code in beforeRouteEnter i can get the warn information like below
beforeRouteEnter(to, from , next){ setTimeout(() => { next() }, 100) }
1

@husayt please help me

@husayt husayt reopened this Mar 17, 2018
@ytudt ytudt changed the title featch use async code in beforeRouteEnter hook,it throw some error Mar 18, 2018
@husayt
Copy link
Contributor

husayt commented Apr 5, 2018

@ytudt still there is no enough detail to help you

@galvez
Copy link

galvez commented Aug 26, 2018

Closing this as there's been no updates over 90 days.

@galvez galvez closed this as completed Aug 26, 2018
@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants