mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
feat(image): Image.PreviewGroup support preview.onChange callback (#40857)
* feat: imageGroup support onChange callback * feat: reset code
This commit is contained in:
parent
6fc08687ae
commit
42e2b73cdf
@ -2,7 +2,11 @@ import React from 'react';
|
|||||||
import { Image } from 'antd';
|
import { Image } from 'antd';
|
||||||
|
|
||||||
const App: React.FC = () => (
|
const App: React.FC = () => (
|
||||||
<Image.PreviewGroup>
|
<Image.PreviewGroup
|
||||||
|
preview={{
|
||||||
|
onChange: (current, prev) => console.log(`current index: ${current}, prev index: ${prev}`),
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Image width={200} src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" />
|
<Image width={200} src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" />
|
||||||
<Image
|
<Image
|
||||||
width={200}
|
width={200}
|
||||||
|
@ -43,10 +43,10 @@ Previewable image.
|
|||||||
|
|
||||||
### previewType
|
### previewType
|
||||||
|
|
||||||
```js
|
```typescript
|
||||||
{
|
{
|
||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
onVisibleChange?: (visible, prevVisible) => void;
|
onVisibleChange?: (visible, prevVisible, current: number) => void; // `current` only support after v5.3.0
|
||||||
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
|
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
|
||||||
src?: string; // v4.10.0
|
src?: string; // v4.10.0
|
||||||
mask?: ReactNode; // v4.9.0
|
mask?: ReactNode; // v4.9.0
|
||||||
@ -54,6 +54,7 @@ Previewable image.
|
|||||||
current?: number; // v4.12.0 Only support PreviewGroup
|
current?: number; // v4.12.0 Only support PreviewGroup
|
||||||
countRender?: (current: number, total: number) => string // v4.20.0 Only support PreviewGroup
|
countRender?: (current: number, total: number) => string // v4.20.0 Only support PreviewGroup
|
||||||
scaleStep?: number;
|
scaleStep?: number;
|
||||||
|
onChange?: (current: number, prevCurrent: number) => void; // only support after v5.3.0
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -44,10 +44,10 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
|
|||||||
|
|
||||||
### previewType
|
### previewType
|
||||||
|
|
||||||
```js
|
```typescript
|
||||||
{
|
{
|
||||||
visible?: boolean;
|
visible?: boolean;
|
||||||
onVisibleChange?: (visible, prevVisible) => void;
|
onVisibleChange?: (visible, prevVisible, current: number) => void; // current 参数v5.3.0后支持
|
||||||
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
|
getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0
|
||||||
src?: string; // v4.10.0
|
src?: string; // v4.10.0
|
||||||
mask?: ReactNode; // v4.9.0
|
mask?: ReactNode; // v4.9.0
|
||||||
@ -56,6 +56,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA
|
|||||||
countRender?: (current: number, total: number) => string // v4.20.0 仅支持 PreviewGroup
|
countRender?: (current: number, total: number) => string // v4.20.0 仅支持 PreviewGroup
|
||||||
scaleStep?: number;
|
scaleStep?: number;
|
||||||
forceRender?: boolean;
|
forceRender?: boolean;
|
||||||
|
onChange?: (current: number, prevCurrent: number) => void; // v5.3.0后支持
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
"rc-drawer": "~6.1.1",
|
"rc-drawer": "~6.1.1",
|
||||||
"rc-dropdown": "~4.0.0",
|
"rc-dropdown": "~4.0.0",
|
||||||
"rc-field-form": "~1.27.0",
|
"rc-field-form": "~1.27.0",
|
||||||
"rc-image": "~5.15.1",
|
"rc-image": "~5.15.2",
|
||||||
"rc-input": "~0.2.1",
|
"rc-input": "~0.2.1",
|
||||||
"rc-input-number": "~7.4.0",
|
"rc-input-number": "~7.4.0",
|
||||||
"rc-mentions": "~2.0.0",
|
"rc-mentions": "~2.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user