@modern-js/main-doc 0.0.0-next-20221216140552 → 0.0.0-next-20221218140542
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# @modern-js/main-doc
|
2
2
|
|
3
|
-
## 0.0.0-next-
|
3
|
+
## 0.0.0-next-20221218140542
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
@@ -30,4 +30,4 @@
|
|
30
30
|
- Updated dependencies [3fae2d03b]
|
31
31
|
- Updated dependencies [df41d71ad]
|
32
32
|
- Updated dependencies [14b712da8]
|
33
|
-
- @modern-js/builder-doc@0.0.0-next-
|
33
|
+
- @modern-js/builder-doc@0.0.0-next-20221218140542
|
package/package.json
CHANGED
@@ -11,20 +11,20 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "0.0.0-next-
|
14
|
+
"version": "0.0.0-next-20221218140542",
|
15
15
|
"publishConfig": {
|
16
16
|
"registry": "https://registry.npmjs.org/",
|
17
17
|
"access": "public"
|
18
18
|
},
|
19
19
|
"peerDependencies": {
|
20
|
-
"@modern-js/builder-doc": "0.0.0-next-
|
20
|
+
"@modern-js/builder-doc": "0.0.0-next-20221218140542"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|
23
23
|
"ts-node": "^10",
|
24
24
|
"fs-extra": "^10",
|
25
25
|
"@types/node": "^16",
|
26
26
|
"@types/fs-extra": "^9",
|
27
|
-
"@modern-js/builder-doc": "0.0.0-next-
|
27
|
+
"@modern-js/builder-doc": "0.0.0-next-20221218140542"
|
28
28
|
},
|
29
29
|
"scripts": {
|
30
30
|
"build": "npx ts-node ./scripts/sync.ts"
|
@@ -64,15 +64,19 @@ function App() {
|
|
64
64
|
export default App;
|
65
65
|
```
|
66
66
|
|
67
|
-
因为框架默认支持 [HMR](https://webpack.js.org/concepts/hot-module-replacement/),可以看到 `http://localhost:8080/` 里的内容会自动变成 Hello Modern.js。
|
68
|
-
|
69
67
|
删除多余的 css 文件,保持目录没有多余的文件:
|
70
68
|
|
71
69
|
```bash
|
72
70
|
rm src/routes/index.css
|
73
71
|
```
|
74
72
|
|
75
|
-
|
73
|
+
因为框架默认支持 [HMR](https://webpack.js.org/concepts/hot-module-replacement/),可以看到 `http://localhost:8080/` 里的内容会自动更新为:
|
74
|
+
|
75
|
+

|
76
|
+
|
77
|
+
此刻的页面还没有样式。下一章节将展开这部分的内容。
|
78
|
+
|
79
|
+
## 开启 SSR
|
76
80
|
|
77
81
|
接下来,我们修改项目中的 `modern.config.ts`,开启 SSR 能力:
|
78
82
|
|
@@ -216,9 +216,9 @@ export const loader = async (): Promise<LoaderData> => {
|
|
216
216
|
|
217
217
|
function Index() {
|
218
218
|
const { data } = useLoaderData() as LoaderData;
|
219
|
-
const [{ items }, { archive,
|
219
|
+
const [{ items }, { archive, setItems }] = useModel(contacts);
|
220
220
|
if (items.length === 0) {
|
221
|
-
|
221
|
+
setItems(data);
|
222
222
|
}
|
223
223
|
|
224
224
|
return (
|