Skip to content

Commit

Permalink
docs(config): loading config docs
Browse files Browse the repository at this point in the history
  • Loading branch information
KuangPF committed Jul 16, 2023
1 parent fb44ecd commit c5d5032
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 9 deletions.
46 changes: 42 additions & 4 deletions example/docs/config/base.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ After configuration, the page will be presented as the homepage, used to display

### sidebarGroupModePath

- type:`Array<string | RegExp> | true`
- type:`Array<string> | true`
- default:`[]`

```ts
Expand All @@ -206,9 +206,7 @@ export default {
// sidebarGroupModePath: true, // when true, all routes will be treated as a group
sidebarGroupModePath: [
// Matches routes starting with `/config`
'/config',
// Support regular matching
/\/guide\//
'/config'
]
}
}
Expand Down Expand Up @@ -261,4 +259,44 @@ export default {

Since dumi only supports two-level sidebar [issues](https://github.com/umijs/dumi/issues/748), if the customization needs need to support three-level sidebar or want to fully customize the sidebar display , you can use this parameter. For configuration parameters, refer to the [items attribute](https://ant.design/components/menu-cn#itemtype) of the ant-design menu component.

## Extended configuration

### loading

- type: `ILoading`.
- default: `undefined`

```ts
interface ILoading {
skeleton?: Array<string>;
}
```

In the loading status of the current page, routing is enabled on demand by default, so there will be a loading process when switching routes. `Dumi-theme-antd` provides two common forms of loading: **Skeleton** and **spin**, and the corresponding loading forms can be set for different routes, with the default Spin form.

<Alert type="warning">
Because dumi does not provide the form of slot to support loading components, it is necessary to manually import the loading components in <code>dumi-theme-antd</code > into <code>.dumi/loading.(js|jsx|ts|tsx)</code > first.
</Alert>

```ts
/* .dumi/loading.tsx */
export { default } from 'dumi-theme-antd/loading';
```

Configure the loading value

```ts
/* .dumirc.ts */
export default {
themeConfig: {
loading: {
Skeleton: [
'/guide',
' /config'
] /* the route loading component at the beginning of /config or /guide are in skeleton form. */
}
}
};
```

[antd-menuitemgrouptype-url]: https://ant.design/components/menu-cn#menuitemgrouptype
45 changes: 40 additions & 5 deletions example/docs/config/base.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: 基础

`dumi-theme-antd` 为了更好地适配 antd v5 官网主题风格,增加了一些特有字段,并将其置于 `dumi` 主题配置项 `themeConfig` 字段中,具体配置字段如下:

## 基础配置
## 基础配置项

### github

Expand Down Expand Up @@ -196,7 +196,7 @@ features: {

### sidebarGroupModePath

- 类型:`Array<string | RegExp> | true`
- 类型:`Array<string> | true`
- 默认值:`[]`

```ts
Expand All @@ -206,9 +206,7 @@ export default {
// sidebarGroupModePath: true, // 当为 true 时,全部都以分组形式展示
sidebarGroupModePath: [
// 匹配以 /config 开头的路由
'/config',
// 支持正则匹配
/\/guide\//
'/config'
]
}
}
Expand Down Expand Up @@ -261,4 +259,41 @@ export default {

由于 dumi 暂只支持两级侧边栏 [issues](https://github.com/umijs/dumi/issues/748),如果定制需求需要支持三级侧边栏或者想完全定制侧边栏展示的,可以使用该参数,配置参数参考 ant-design menu 组件的 [items 属性](https://ant.design/components/menu-cn#itemtype)

## 扩展配置项

### loading

- 类型:`ILoading`
- 默认值:`undefined`

```ts
interface ILoading {
skeleton?: Array<string>;
}
```

当前页面的加载状态,由于默认启用路由按需加载,所以切换路由时会有 loading 的过程,`dumi-theme-antd` 提供了常见的两种 loading 形式:**Skeleton** 以及 **Spin**,可对不同的路由设置对应的加载形式,默认 spin 形式。

<Alert type="warning">
由于 dumi 没有提供 slot 的形式来支持加载组件,因此首先需要手动将 <code>dumi-theme-antd</code> 中加载组件引入到 <code>.dumi/loading.(js|jsx|ts|tsx)</code> 中
</Alert>

```ts
/* .dumi/loading.tsx */
export { default } from 'dumi-theme-antd/loading';
```

配置 loading 值

```ts
/* .dumirc.ts */
export default {
themeConfig: {
loading: {
skeleton: ['/guide', '/config'] /* /guide 以及 /config 开头的路由加载组件为 skeleton 形式 */
}
}
};
```

[antd-menuitemgrouptype-url]: https://ant.design/components/menu-cn#menuitemgrouptype

0 comments on commit c5d5032

Please sign in to comment.