File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -90,8 +90,7 @@ webpack4-ssr-config
90
90
```
91
91
#### ` index.js `
92
92
` index.js ` 是我们应用程序的「通用 entry」,对外导出一个 createApp 函数。这里使用工厂模式为为每个请求创建一个新的根 Vue 实例,
93
- 从而避免server端单例模式,如果我们在多个请求之间使用一个共享的实例,很容易导致交叉请求状态污染 (cross-request state pollution)。
94
-
93
+ 从而避免server端单例模式,如果我们在多个请求之间使用一个共享的实例,很容易导致交叉请求状态污染。
95
94
#### ` entry-client.js ` :
96
95
97
96
客户端 entry 只需创建应用程序,并且将其挂载到 DOM 中:
@@ -245,7 +244,7 @@ export function createStore() {
245
244
}
246
245
```
247
246
248
- ### http请求
247
+ ### Http请求
249
248
http使用Axios库封装
250
249
251
250
``` js
@@ -344,7 +343,7 @@ addResponseInterceptor(
344
343
}
345
344
)
346
345
` ` `
347
- 这样,.vue 中间中直接调用this .$http .get ()等等
346
+ 这样,.vue 中间中直接调用this .$http .get ()、 this . $http . post () ...
348
347
349
348
### cookies穿透
350
349
在ssr期间我们需要截取客户端的cookie,保持用户会话唯一性。
@@ -415,7 +414,8 @@ app.on('error', (err) => {
415
414
app .listen (appConfig .appPort )
416
415
```
417
416
418
- #### ` vue.koa.ssr.js ` vue koa2 ssr中间件
417
+ #### ` vue.koa.ssr.js `
418
+ vue koa2 ssr中间件
419
419
420
420
* 开发模式直接使用` setup.dev.server.js ` webpack hot热更新
421
421
* 生产模块直接读取` dist ` 目录的文件
@@ -597,7 +597,7 @@ location / {
597
597
* [ pm2] ( http://www.cnblogs.com/chyingp/p/pm2-documentation.html )
598
598
599
599
600
- [ Demo地址] ( http://www.ml-ui.com/ssr ) 服务器带框垃圾 ,将就看看。
600
+ [ Demo地址] ( http://www.ml-ui.com/ssr ) 服务器带宽垃圾 ,将就看看。
601
601
602
602
[ git仓库地址] ( https://github.com/zdliuccit/vue-webpack-config/tree/master/webpack4-ssr-config )
603
603
You can’t perform that action at this time.
0 commit comments