我正在使用 react-draggable 将一个 div 拖到 table 上的另一个位置。问题是我需要有基础 <td>
的火 onMouseOver
当我将 div 拖到它们上方时发生的事件。但是由于我的鼠标在可拖动的 div 上,鼠标事件不会在底层 <td>
上触发。的。
我试过使用 pointer-events: none;
但这会导致可拖动对象不可拖动。
<td className={cls} onClick={this.handleCancelOpenOrders} onMouseOver={this.handleMouseOver}>
<Draggable axis="y" position={{ x: 0, y: 0 }} onDrag={this.handleDrag} onStart={this.handleDragStart} onStop={this.handleDragStop}>
<div className={styles[this.props.type]}>
<span className={styles.currentOrderText}>
{orderQuantity}
</span>
</div>
</Draggable>
</td>
最佳答案
我能够通过创建一个可观察的 isDraggable 来解决这个问题,当它为真时设置指针事件:无;在被拖动的 div 上。
关于javascript - 拖动 div 时的 onMouseOver 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48011450/