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.
39 lines
1.1 KiB
39 lines
1.1 KiB
3 years ago
|
---
|
||
|
category: Components
|
||
|
type: 数据展示
|
||
|
title: Image
|
||
|
subtitle: 图片
|
||
|
cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg
|
||
|
---
|
||
|
|
||
|
可预览的图片。
|
||
|
|
||
|
## 何时使用
|
||
|
|
||
|
- 需要展示图片时使用。
|
||
|
- 加载大图时显示 loading 或加载失败时容错处理。
|
||
|
|
||
|
## API
|
||
|
|
||
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||
|
| --- | --- | --- | --- | --- |
|
||
|
| alt | 图像描述 | string | - | 2.0.0 |
|
||
|
| fallback | 加载失败容错地址 | string | - | 2.0.0 |
|
||
|
| height | 图像高度 | string \| number | - | 2.0.0 |
|
||
|
| placeholder | 加载占位, 为 `true` 时使用默认占位 | boolean \| slot | - | 2.0.0 |
|
||
|
| preview | 预览参数,为 `false` 时禁用 | boolean \| [previewType](#previewType) | true | 2.0.0 |
|
||
|
| src | 图片地址 | string | - | 2.0.0 |
|
||
|
| width | 图像宽度 | string \| number | - | 2.0.0 |
|
||
|
|
||
|
### previewType
|
||
|
|
||
|
```js
|
||
|
{
|
||
|
visible?: boolean;
|
||
|
onVisibleChange?: (visible, prevVisible) => void;
|
||
|
getContainer: string | HTMLElement | (() => HTMLElement);
|
||
|
}
|
||
|
```
|
||
|
|
||
|
其他属性见 [<img>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Attributes)
|