mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
feat(components): [image-viewer] Add rotate event when rotating images (#14138)
* feat(components): [image-viewer] Add rotate event when rotating images * Update docs/en-US/component/image.md Co-authored-by: btea <2356281422@qq.com> --------- Co-authored-by: btea <2356281422@qq.com>
This commit is contained in:
parent
9a60a90e1e
commit
95494b7154
@ -116,6 +116,7 @@ image/image-preview
|
||||
| ------ | ------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
||||
| close | trigger when clicking on close button or when `hide-on-click-modal` enabled clicking on backdrop. | ^[Function]`() => void` |
|
||||
| switch | trigger when switching images. | ^[Function]`(index: number) => void` |
|
||||
| rotate ^(2.3.13) | trigger when rotating images. | ^[Function]`(deg: number) => void` |
|
||||
|
||||
### Image Viewer Exposes
|
||||
|
||||
|
@ -70,6 +70,7 @@ export type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>
|
||||
export const imageViewerEmits = {
|
||||
close: () => true,
|
||||
switch: (index: number) => isNumber(index),
|
||||
rotate: (deg: number) => isNumber(deg),
|
||||
}
|
||||
export type ImageViewerEmits = typeof imageViewerEmits
|
||||
|
||||
|
@ -345,9 +345,11 @@ function handleActions(action: ImageViewerAction, options = {}) {
|
||||
break
|
||||
case 'clockwise':
|
||||
transform.value.deg += rotateDeg
|
||||
emit('rotate', transform.value.deg)
|
||||
break
|
||||
case 'anticlockwise':
|
||||
transform.value.deg -= rotateDeg
|
||||
emit('rotate', transform.value.deg)
|
||||
break
|
||||
}
|
||||
transform.value.enableTransition = enableTransition
|
||||
|
Loading…
Reference in New Issue
Block a user