我有这段代码,它是一个标签,onClick
里面有一个事件。我的问题是,当我在浏览器中单击 div 时,会触发 href,然后我将转到另一个站点。有没有办法确保只有 onClick is triggered when clicking on
chnageOrder onClick` 和链接在单击 a 标签的其余部分时有效?
<div key={idx.toString()}>
<a className="stage-container" href={stageUrl}>
<h3>{stage.title}</h3>
<div className="arrow-container">
<div
className=""
onClick={() =>
changeOrder(stage.id, stage.title, stage.order - 1)
}
>
<i className="fa fa-caret-up" />
</div>
<div
onClick={() =>
changeOrder(stage.id, stage.title, stage.order + 1)
}
>
<i className="fa fa-caret-down" />
</div>
</div>
</a>
<div className="substages-container">
{sortSubstages.map((substage, index) => (
<SubstageItem
className="substage-container"
key={index.toString()}
substage={substage}
reload={reload}
/>
))}
</div>
</div >