如何在React中的图像映射中检测区域标签onClick

问题描述 投票:2回答:1

我想在图像的不同部分上检测onClickonHover

<img src={physicalimage} id="physicalimage" usemap="#image-map"/>
   <map name="image-map">
   <area target="" onClick={this.consoleMessage("bpleft")} alt="bpleft" title="bpleft"  coords="223,201,269,254" shape="rect" />
   <area target="" onClick={this.consoleMessage("bpright")} alt="bpright" title="bpright" coords="60,199,101,259" shape="rect" />
   <area target="" onClick={this.consoleMessage("heart")} alt="heartrate"  title="heartrate" coords="169,124,219,183" shape="rect" />
</map>

我使用React库开发我的网站。我无法检测到onClick事件。还有其他选择吗?

html image reactjs imagemap
1个回答
0
投票
我当前正在做完全相同的事情,偶然发现了这个Package:React Image Mapper
© www.soinside.com 2019 - 2024. All rights reserved.