You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
9 years ago
|
---
|
||
|
category: Components
|
||
|
chinese: 全局提示
|
||
9 years ago
|
type: Views
|
||
9 years ago
|
noinstant: true
|
||
|
english: Message
|
||
|
---
|
||
10 years ago
|
|
||
10 years ago
|
全局展示操作反馈信息。
|
||
10 years ago
|
|
||
10 years ago
|
## 何时使用
|
||
10 years ago
|
|
||
10 years ago
|
- 可提供成功、警告和错误等反馈信息。
|
||
|
- 顶部居中显示并自动消失,是一种不打断用户操作的轻量级提示方式。
|
||
10 years ago
|
|
||
|
## API
|
||
|
|
||
|
- `message.success(content, duration)`
|
||
|
- `message.error(content, duration)`
|
||
|
- `message.info(content, duration)`
|
||
9 years ago
|
- `message.warning(content, duration)`
|
||
9 years ago
|
- `message.warn(content, duration)`
|
||
9 years ago
|
- `message.loading(content, duration)`
|
||
10 years ago
|
|
||
9 years ago
|
组件提供了四个静态方法,参数如下:
|
||
10 years ago
|
|
||
|
| 参数 | 说明 | 类型 | 默认值 |
|
||
9 years ago
|
|------------|----------------|--------------------------|--------------|
|
||
|
| content | 提示内容 | React.Element or String | - |
|
||
|
| duration | 自动关闭的延时,单位秒 | number | 1.5 |
|
||
9 years ago
|
|
||
9 years ago
|
还提供了全局配置和全局销毁方法:
|
||
9 years ago
|
|
||
|
- `message.config(options)`
|
||
9 years ago
|
- `message.destroy()`
|
||
9 years ago
|
|
||
|
```js
|
||
|
message.config({
|
||
9 years ago
|
top: 100,
|
||
|
duration: 2,
|
||
9 years ago
|
});
|
||
|
```
|
||
|
|
||
9 years ago
|
| 参数 | 说明 | 类型 | 默认值 |
|
||
|
|------------|--------------------|--------------------------|-------------|
|
||
|
| top | 消息距离顶部的位置 | Number | 24px |
|
||
|
| duration | 默认自动关闭延时,单位秒 | Number | 1.5 |
|