@modern-js/main-doc 0.0.0-nightly-20231007160533 → 0.0.0-nightly-20231008160538
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/docs/en/apis/app/hooks/src/routes.mdx +1 -1
- package/docs/en/guides/advanced-features/rspack-start.mdx +1 -1
- package/docs/en/guides/advanced-features/ssr.mdx +17 -17
- package/docs/en/guides/basic-features/data/_category_.json +4 -0
- package/docs/en/guides/basic-features/{data-fetch.mdx → data/data-fetch.mdx} +35 -27
- package/docs/en/guides/basic-features/data/data-write.mdx +241 -0
- package/docs/en/guides/basic-features/routes.mdx +6 -6
- package/docs/en/tutorials/first-app/c05-loader.mdx +2 -2
- package/docs/en/tutorials/first-app/c06-model.mdx +4 -4
- package/docs/en/tutorials/first-app/c07-container.mdx +3 -3
- package/docs/zh/apis/app/hooks/src/routes.mdx +1 -1
- package/docs/zh/guides/advanced-features/rspack-start.mdx +1 -1
- package/docs/zh/guides/advanced-features/ssr.mdx +16 -16
- package/docs/zh/guides/basic-features/data/_category_.json +4 -0
- package/docs/zh/guides/basic-features/{data-fetch.mdx → data/data-fetch.md} +31 -27
- package/docs/zh/guides/basic-features/data/data-write.mdx +236 -0
- package/docs/zh/guides/basic-features/routes.mdx +6 -6
- package/docs/zh/tutorials/first-app/c05-loader.mdx +2 -2
- package/docs/zh/tutorials/first-app/c06-model.mdx +3 -3
- package/docs/zh/tutorials/first-app/c07-container.mdx +3 -3
- package/package.json +5 -5
@@ -15,7 +15,7 @@ import { Tabs, Tab as TabItem } from "@theme";
|
|
15
15
|
|
16
16
|
Modern.js 支持在 `layout.tsx` 通过 Data Loader 获取数据,我们先数据获取这部分代码移动到 `src/routes/layout.tsx` 中:
|
17
17
|
|
18
|
-
```ts title="src/routes/layout.
|
18
|
+
```ts title="src/routes/layout.data.ts"
|
19
19
|
export type LoaderData = {
|
20
20
|
code: number;
|
21
21
|
data: {
|
@@ -25,7 +25,7 @@ export type LoaderData = {
|
|
25
25
|
}[];
|
26
26
|
};
|
27
27
|
|
28
|
-
export
|
28
|
+
export const loader = async (): Promise<LoaderData> => {
|
29
29
|
const data = new Array(20).fill(0).map(() => {
|
30
30
|
const firstName = name.firstName();
|
31
31
|
return {
|
@@ -58,7 +58,7 @@ import 'tailwindcss/base.css';
|
|
58
58
|
import 'tailwindcss/components.css';
|
59
59
|
import 'tailwindcss/utilities.css';
|
60
60
|
import '../styles/utils.css';
|
61
|
-
import type { LoaderData } from './layout.
|
61
|
+
import type { LoaderData } from './layout.data';
|
62
62
|
|
63
63
|
export default function Layout() {
|
64
64
|
const { data } = useLoaderData() as LoaderData;
|
package/package.json
CHANGED
@@ -15,17 +15,17 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "0.0.0-nightly-
|
18
|
+
"version": "0.0.0-nightly-20231008160538",
|
19
19
|
"publishConfig": {
|
20
20
|
"registry": "https://registry.npmjs.org/",
|
21
21
|
"access": "public",
|
22
22
|
"provenance": true
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
|
-
"@modern-js/sandpack-react": "0.0.0-nightly-
|
25
|
+
"@modern-js/sandpack-react": "0.0.0-nightly-20231008160538"
|
26
26
|
},
|
27
27
|
"peerDependencies": {
|
28
|
-
"@modern-js/builder-doc": "0.0.0-nightly-
|
28
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20231008160538"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"classnames": "^2",
|
@@ -39,8 +39,8 @@
|
|
39
39
|
"@rspress/shared": "1.0.0-beta.0",
|
40
40
|
"@types/node": "^16",
|
41
41
|
"@types/fs-extra": "^9",
|
42
|
-
"@modern-js/builder-doc": "0.0.0-nightly-
|
43
|
-
"@modern-js/doc-plugin-auto-sidebar": "0.0.0-nightly-
|
42
|
+
"@modern-js/builder-doc": "0.0.0-nightly-20231008160538",
|
43
|
+
"@modern-js/doc-plugin-auto-sidebar": "0.0.0-nightly-20231008160538"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"dev": "rspress dev",
|