Authored by 陈峰

commit

@@ -5,14 +5,17 @@ import { @@ -5,14 +5,17 @@ import {
5 import {createApp} from './app'; 5 import {createApp} from './app';
6 import {createApi} from 'create-api'; 6 import {createApi} from 'create-api';
7 import {Style, Toast, Dialog} from 'cube-ui'; //eslint-disable-line 7 import {Style, Toast, Dialog} from 'cube-ui'; //eslint-disable-line
  8 +import {get} from 'lodash';
8 import Lazy from 'vue-lazyload'; 9 import Lazy from 'vue-lazyload';
9 import yoho from 'common/yoho'; 10 import yoho from 'common/yoho';
10 import 'statics/scss/common.scss'; 11 import 'statics/scss/common.scss';
11 import 'statics/font/iconfont.css'; 12 import 'statics/font/iconfont.css';
12 import 'statics/font/ufofont.css'; 13 import 'statics/font/ufofont.css';
13 14
14 -const isDegrade = Boolean(!window.__INITIAL_STATE__);  
15 -const context = window.__INITIAL_STATE__ && window.__INITIAL_STATE__.yoho.context; 15 +const $app = document.getElementById('app');
  16 +
  17 +const isDegrade = Boolean(!($app && $app.attributes['data-server-rendered']));
  18 +const context = get(window, '__INITIAL_STATE__.yoho.context');
16 const {app, router, store} = createApp(context); 19 const {app, router, store} = createApp(context);
17 20
18 if (window.__INITIAL_STATE__) { 21 if (window.__INITIAL_STATE__) {
@@ -38,11 +38,6 @@ const getContext = (req) => { @@ -38,11 +38,6 @@ const getContext = (req) => {
38 url: req.url, 38 url: req.url,
39 title: 'BLK2!', 39 title: 'BLK2!',
40 user: req.user, 40 user: req.user,
41 - state: {  
42 - yoho: {  
43 - context: {}  
44 - }  
45 - },  
46 env: { 41 env: {
47 isApp: req.yoho.isApp, 42 isApp: req.yoho.isApp,
48 isiOS: req.yoho.isiOS, 43 isiOS: req.yoho.isiOS,