Commit 1c54aa9 1 parent 3876a24 commit 1c54aa9 Copy full SHA for 1c54aa9
File tree 6 files changed +40
-4
lines changed
6 files changed +40
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ id : add-404-page
3
+ title : 添加 404 页面
4
+ ---
5
+
6
+ umi 中约定 pages 目录下的 404.js 为 404 页面,这个文件需要返回 React 组件。比如:
7
+
8
+ ``` js
9
+ export default () => {
10
+ return (
11
+ < div> 404 page< / div>
12
+ );
13
+ };
14
+ ```
15
+
16
+ 开发模式下,umi 会添加一个默认的 404 页面,但你仍然可通过精确地访问 ` /404 ` 来验证 404 页面。
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ title: 目录结构
15
15
├── .umi/ // dev 临时目录,需添加到 .gitignore
16
16
├── .umi-production/ // build 临时目录,会自动删除
17
17
├── document.ejs // HTML 模板
18
- ├── list.js // 页面 1
19
- └── index.js // 页面 2
18
+ ├── 404.js // 404 页面
19
+ ├── page1.js // 页面 1,任意命名
20
+ └── page2.js // 页面 2,任意命名
20
21
├── global.css // 约定的全局样式文件,自动引入,也可以用 global.less
21
22
├── _routes.json // 路由配置,和文件路由二选一
22
23
├── test/ // 测试用例放这里
Original file line number Diff line number Diff line change 4
4
"next" : " Next" ,
5
5
"previous" : " Previous" ,
6
6
"tagline" : " Blazing-fast next.js-like framework for React apps." ,
7
+ "add-404-page" : " 添加 404 页面" ,
7
8
"api" : " API" ,
8
9
"app-structure" : " 目录结构" ,
9
10
"cli" : " 命令行" ,
Original file line number Diff line number Diff line change 12
12
],
13
13
"Guides" : [
14
14
" router" ,
15
+ " add-404-page" ,
15
16
" html-tpl" ,
16
17
" load-on-demand" ,
17
18
" pwa" ,
Original file line number Diff line number Diff line change
1
+ ---
2
+ id : add-404-page
3
+ title : 添加 404 页面
4
+ ---
5
+
6
+ umi 中约定 pages 目录下的 404.js 为 404 页面,这个文件需要返回 React 组件。比如:
7
+
8
+ ``` js
9
+ export default () => {
10
+ return (
11
+ < div> 404 page< / div>
12
+ );
13
+ };
14
+ ```
15
+
16
+ 开发模式下,umi 会添加一个默认的 404 页面,但你仍然可通过精确地访问 ` /404 ` 来验证 404 页面。
Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ title: 目录结构
15
15
├── .umi/ // dev 临时目录,需添加到 .gitignore
16
16
├── .umi-production/ // build 临时目录,会自动删除
17
17
├── document.ejs // HTML 模板
18
- ├── list.js // 页面 1
19
- └── index.js // 页面 2
18
+ ├── 404.js // 404 页面
19
+ ├── page1.js // 页面 1,任意命名
20
+ └── page2.js // 页面 2,任意命名
20
21
├── global.css // 约定的全局样式文件,自动引入,也可以用 global.less
21
22
├── _routes.json // 路由配置,和文件路由二选一
22
23
├── test/ // 测试用例放这里
You can’t perform that action at this time.
0 commit comments