...
|
...
|
@@ -22,7 +22,7 @@ if (window.__INITIAL_STATE__) { |
|
|
store.replaceState(window.__INITIAL_STATE__);
|
|
|
}
|
|
|
|
|
|
window._router = store.state.yoho.context.route;
|
|
|
window._router = get(store, 'state.yoho.context.route');
|
|
|
|
|
|
Vue.prop('yoho', yoho);
|
|
|
Vue.use(Toast);
|
...
|
...
|
@@ -31,13 +31,9 @@ Vue.prop('api', createApi()); |
|
|
Vue.use(Lazy, {error: ''});
|
|
|
|
|
|
const fetchAsycData = (matched, r) => {
|
|
|
const asyncDataPromises = matched.map(({asyncData}) => {
|
|
|
try {
|
|
|
return asyncData && asyncData({store, router: r});
|
|
|
} catch (error) {
|
|
|
return Promise.reject(error);
|
|
|
}
|
|
|
}).filter(p => p);
|
|
|
const asyncDataPromises = matched
|
|
|
.map(({asyncData}) => asyncData && asyncData({store, router: r})).
|
|
|
filter(p => p);
|
|
|
|
|
|
return Promise.all(asyncDataPromises);
|
|
|
};
|
...
|
...
|
|