Skip to content

Commit 1eab4c1

Browse files
committed
fix(imagepicker): fix repeat open select img when clicking remove btn
1 parent 5c0ed1f commit 1eab4c1

File tree

1 file changed

+4
-1
lines changed
  • packages/taro-ui/src/components/image-picker

1 file changed

+4
-1
lines changed

packages/taro-ui/src/components/image-picker/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import classNames from 'classnames'
22
import PropTypes, { InferProps } from 'prop-types'
33
import React from 'react'
44
import { Image, View } from '@tarojs/components'
5+
import { ITouchEvent } from '@tarojs/components/types/common'
56
import Taro from '@tarojs/taro'
67
import { AtImagePickerProps, File } from '../../../types/image-picker'
78
import { uuid } from '../../common/utils'
@@ -82,7 +83,9 @@ export default class AtImagePicker extends React.Component<AtImagePickerProps> {
8283
this.props.onImageClick(idx, this.props.files[idx])
8384
}
8485

85-
private handleRemoveImg = (idx: number): void => {
86+
private handleRemoveImg = (idx: number, event: ITouchEvent): void => {
87+
event.stopPropagation()
88+
event.preventDefault()
8689
const { files = [] } = this.props
8790
if (ENV === Taro.ENV_TYPE.WEB) {
8891
window.URL.revokeObjectURL(files[idx].url)

0 commit comments

Comments
 (0)