Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve router config docs #6232

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import RouterLegacyTip from "@site-docs-en/components/router-legacy-tip"

<RouterLegacyTip />

# runtime.router

- **Type:** `boolean | Object`
- **Default:** `false`

When enabled, the router option provides routing management for Modern.js conventional routes. It is based on [React Router 6](https://reactrouter.com/).
This value is set to `true` when the project is created, supporting the use of [conventional routing](/guides/concept/entries.html#约定式路由) provided by Modern.js for routing management.

If you wish to use [controlled routing](/guides/concept/entries.html#自控式路由), please remove this value or set it to `false`.

:::note
All sub-configurations of `router` will only take effect when using conventional routing.
:::

## basename

Expand All @@ -22,6 +26,10 @@ When enabled, the router option provides routing management for Modern.js conven

The basename option specifies the subpath where the app is deployed, for situations where it cannot be deployed to the root domain.

:::tip
推荐使用 [`server.baseUrl`](/configure/app/server/base-url) 进行配置。
:::

## supportHtml5History

- **Type:** `boolean`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ title: state

Once `state` is enabled, you can use [Model](/guides/topic-detail/model/quick-start) for state management.

The specific configuration options are as follows:

## models

- **Type:** `Array<Model>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import RouterLegacyTip from "@site-docs/components/router-legacy-tip"

<RouterLegacyTip />

# runtime.router

- **类型:** `boolean | Object`
- **默认值:** `false`

开启 `router` 之后,支持使用 Modern.js 默认提供的约定式路由进行路由管理。Modern.js 的路由模块基于 [React Router 6](https://reactrouter.com/) 实现。
该值在项目创建时被设置为 `true`,支持使用 Modern.js 默认提供的[约定式路由](/guides/concept/entries.html#约定式路由)进行路由管理。

如果希望使用[自控式路由](/guides/concept/entries.html#自控式路由),请移除该值,或将该值设置为 `false`。

具体配置如下:
:::note
`router` 的所有子配置都只会在使用约定式路由时生效。
:::

## basename

Expand All @@ -24,6 +26,10 @@ import RouterLegacyTip from "@site-docs/components/router-legacy-tip"

设置客户端路由的 `basename`,通常用于应用需要部署在域名非根路径下的场景。

:::tip
推荐使用 [`server.baseUrl`](/configure/app/server/base-url) 进行配置。
:::

## supportHtml5History

- **类型:** `boolean`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ title: state

开启 `state` 后就可以使用 [Model](/guides/topic-detail/model/quick-start) 来做状态管理。

具体配置项如下:

## models

- **类型:** `Array<Model>`
Expand Down
Loading