当拖动停止使用React时如何还原可拖动组件的位置

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

我有一个Draggable组件,其中有一个容器。我希望在停止拖动时重设Draggable的位置(onStop)。这是我的Draggable的属性:

<Draggable
    axis="x"
    bounds={{top: 0, bottom: 0, left: -75, right: 0}}
    onStop={//what to do here}
>

我该怎么做?

javascript reactjs draggable
1个回答
1
投票

所以,我进行了研究,您可以只使用position={{x: 0, y: 0}}使它起作用。

© www.soinside.com 2019 - 2024. All rights reserved.