image touch无效
-
想实现一个简单的图片裁剪功能,但是图片onTouchStart没有被调用,但是下面的view是又被调用的。是因为image标签无法使用onTouch的事件监控吗
import Taro from '@tarojs/taro'; import React, { useEffect, useImperativeHandle } from 'react'; import { View, Canvas, Image } from '@tarojs/components'; import "./index.scss"; interface ImageCropperPropsType { imgSrc, cut_ratio?: 1, //裁剪框的 宽/高 比 } const ImageCropper: React.FC <ImageCropperPropsType> = props => { const { imgSrc, cut_ratio } = props useEffect(() => { }) const handleTouch = (e) =>{ console.log('e', e); } const handleClick = (e) => { console.log('click', e); } return ( <View className='cut_wrapper' > <Image className='img' src={imgSrc} onTouchStart={handleTouch.bind(this)} /> <View onTouchStart={handleTouch.bind(this)}> ghhgdf </View> </View> ) } export default ImageCropper;