docs: update alert and apiComponent docs (#5961)

This commit is contained in:
Netfan 2025-04-15 20:52:23 +08:00 committed by GitHub
parent 333998b518
commit d18f56177c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -42,7 +42,11 @@ Alert提供的快捷方法alert、confirm、prompt动态创建的弹窗在已打
当弹窗的content、footer、icon使用自定义组件时在这些组件中可以使用 `useAlertContext` 获取当前弹窗的上下文对象,用来主动控制弹窗。
::: tip 注意 `useAlertContext`只能用在setup或者函数式组件中。:::
::: tip 注意
`useAlertContext`只能用在setup或者函数式组件中。
:::
### Methods

View File

@ -151,17 +151,17 @@ function fetchApi(): Promise<Record<string, any>> {
| options | 直接传入选项数据也作为api返回空数据时的后备数据 | `OptionsItem[]` | - | - |
| visibleEvent | 触发重新请求数据的事件名 | `string` | - | - |
| loadingSlot | 目标组件的插槽名称,用来显示一个"加载中"的图标 | `string` | - | - |
| autoSelect | 自动设置选项 | `'first' \| 'last' \| 'one'\| (item: OptionsItem[]) => OptionsItem \| false` | `false` | >5.5.4 |
| autoSelect | 自动设置选项 | `'first' \| 'last' \| 'one'\| ((item: OptionsItem[]) => OptionsItem) \| false` | `false` | >5.5.4 |
#### autoSelect 自动设置选项
如果当前值为undefined在选项数据成功加载之后自动从备选项中选择一个作为当前值。默认值为`false`,即不自动选择选项。注意:该属性不应用于多选组件。可选值有:
- `first`:自动选择第一个选项
- `last`:自动选择最后一个选项
- `one`:有且仅有一个选项时,自动选择它
- `函数`自定义选择逻辑函数的参数为options返回值为选择的选项
- false不自动选择选项
- `"first"`:自动选择第一个选项
- `"last"`:自动选择最后一个选项
- `"one"`:有且仅有一个选项时,自动选择它
- `自定义函数`自定义选择逻辑函数的参数为options返回值为选择的选项
- `false`:不自动选择选项
### Methods