Authored by 陈峰

commit

@@ -12,6 +12,7 @@ import 'statics/font/iconfont.css'; @@ -12,6 +12,7 @@ import 'statics/font/iconfont.css';
12 import 'statics/font/ufofont.css'; 12 import 'statics/font/ufofont.css';
13 13
14 const {app, router, store} = createApp(window.__INITIAL_STATE__ && window.__INITIAL_STATE__.yoho.context); 14 const {app, router, store} = createApp(window.__INITIAL_STATE__ && window.__INITIAL_STATE__.yoho.context);
  15 +const isDegrade = Boolean(!window.__INITIAL_STATE__);
15 16
16 if (window.__INITIAL_STATE__) { 17 if (window.__INITIAL_STATE__) {
17 store.replaceState(window.__INITIAL_STATE__); 18 store.replaceState(window.__INITIAL_STATE__);
@@ -76,7 +77,7 @@ router.onReady(() => { @@ -76,7 +77,7 @@ router.onReady(() => {
76 return next(); 77 return next();
77 } 78 }
78 }); 79 });
79 - app.$mount('#app'); 80 + app.$mount(isDegrade ? '#degrade-app' : '#app');
80 }); 81 });
81 82
82 router.onError(e => { 83 router.onError(e => {
@@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
16 </head> 16 </head>
17 <body> 17 <body>
18 <!--vue-ssr-outlet--> 18 <!--vue-ssr-outlet-->
  19 + <div id="degrade-app"></div>
  20 + div
19 <div id="main-wrap"> 21 <div id="main-wrap">
20 <div id="no-download"></div> 22 <div id="no-download"></div>
21 </div> 23 </div>
@@ -113,7 +113,7 @@ const webpackConfig = merge(baseConfig, { @@ -113,7 +113,7 @@ const webpackConfig = merge(baseConfig, {
113 'process.env.VUE_ENV': '"client"' 113 'process.env.VUE_ENV': '"client"'
114 }), 114 }),
115 new HtmlWebpackPlugin({ 115 new HtmlWebpackPlugin({
116 - filename: '../../degrade.html', 116 + filename: isProd ? '../../degrade.html' : 'degrade.html',
117 template: 'apps/index.html', 117 template: 'apps/index.html',
118 inject: true 118 inject: true
119 }) 119 })
@@ -9,6 +9,7 @@ const routes = require('../../config/ssr-routes'); @@ -9,6 +9,7 @@ const routes = require('../../config/ssr-routes');
9 const redis = require('../../utils/redis'); 9 const redis = require('../../utils/redis');
10 const routeEncode = require('../../utils/route-encode'); 10 const routeEncode = require('../../utils/route-encode');
11 const {createBundleRenderer} = require('vue-server-renderer'); 11 const {createBundleRenderer} = require('vue-server-renderer');
  12 +const rp = require('request-promise');
12 const logger = global.yoho.logger; 13 const logger = global.yoho.logger;
13 const config = global.yoho.config; 14 const config = global.yoho.config;
14 15