Closed wwqhy closed 6 years ago
The above is the client code.My problem is that the top progress bar and page response are not synchronized.thanks.
router.beforeResolve((to, from, next) => { const matched = router.getMatchedComponents(to) const prevMatched = router.getMatchedComponents(from) let diffed = false const activated = matched.filter((c, i) => { return diffed || (diffed = (prevMatched[i] !== c)) }) const asyncDataHooks = activated.map(c => c.asyncData).filter( => ) if (!asyncDataHooks.length) { return next() } bar.start() Promise.all(asyncDataHooks.map(hook => hook({ store, route: to }))) .then(() => { bar.finish() next() }) .catch(next) })
The above is the client code.My problem is that the top progress bar and page response are not synchronized.thanks.