Authored by 陈峰

commit

@@ -22,7 +22,7 @@ if (window.__INITIAL_STATE__) { @@ -22,7 +22,7 @@ if (window.__INITIAL_STATE__) {
22 store.replaceState(window.__INITIAL_STATE__); 22 store.replaceState(window.__INITIAL_STATE__);
23 } 23 }
24 24
25 -window._router = store.state.yoho.context.route; 25 +window._router = get(store, 'state.yoho.context.route');
26 26
27 Vue.prop('yoho', yoho); 27 Vue.prop('yoho', yoho);
28 Vue.use(Toast); 28 Vue.use(Toast);
@@ -31,13 +31,9 @@ Vue.prop('api', createApi()); @@ -31,13 +31,9 @@ Vue.prop('api', createApi());
31 Vue.use(Lazy, {error: ''}); 31 Vue.use(Lazy, {error: ''});
32 32
33 const fetchAsycData = (matched, r) => { 33 const fetchAsycData = (matched, r) => {
34 - const asyncDataPromises = matched.map(({asyncData}) => {  
35 - try {  
36 - return asyncData && asyncData({store, router: r});  
37 - } catch (error) {  
38 - return Promise.reject(error);  
39 - }  
40 - }).filter(p => p); 34 + const asyncDataPromises = matched
  35 + .map(({asyncData}) => asyncData && asyncData({store, router: r})).
  36 + filter(p => p);
41 37
42 return Promise.all(asyncDataPromises); 38 return Promise.all(asyncDataPromises);
43 }; 39 };