Skip to content

Commit

Permalink
chore: docs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Jul 5, 2023
1 parent d293daa commit 1f81a69
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/docs/guides/directory-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ dev 时的临时文件目录,比如入口文件、路由等,都会被临时

build 时的临时文件目录,比如入口文件、路由等,都会被临时生成到这里。**不要提交 .umi-production 目录到 git 仓库,他们会在 alita build 时被删除并重新生成。**

### layout 目录
#### layout.tsx
### layouts 目录
#### layouts/index.tsx.tsx
约定式路由时的全局布局文件,实际上是在路由外面套了一层。比如路由是:

```
Expand Down
21 changes: 14 additions & 7 deletions examples/boilerplate/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { join } from 'path';
import { IApi } from 'umi';

export default (api: IApi) => {
api.onDevCompileDone((opts) => {
opts;
// console.log('> onDevCompileDone', opts.isFirstCompile);
});
api.onBuildComplete((opts) => {
opts;
// console.log('> onBuildComplete', opts.isFirstCompile);
api.addLayouts(() => {
return [
{
id: 'custom-layout',
// 这里写路径,现在是 src/component/layout
// import React from 'react';
// const Layout = ({ children }) => {
/// return <div>123{children}</div>;
/// };
/// export default Layout;
file: join(api.paths.absSrcPath, 'layouts/layout'),
},
];
});
};
7 changes: 7 additions & 0 deletions examples/boilerplate/src/layouts/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

const Layout = ({ children }) => {
return <>{children}</>;
};

export default Layout;

0 comments on commit 1f81a69

Please sign in to comment.