我正在尝试实现缩放功能。onClick 工作正常,但我想在按住缩放按钮时使用它,它会连续缩放。我怎样才能用 ReactJS 实现这个?
Jquery:mousedown 效果(按住左键单击时) 我使用它作为模板,但是 onMousedown 没有根据 console.log 注册
<div className="zoomControl" >
<button className="zoomIn" onMouseDown={this.zoomIn}>+</button>
<button className="zoomOut" onClick={this.zoomOut}>-</button>
</div>
zoomIn = () => {
console.log('test');
var self = this;
this.timeout = setInterval(function(){
// Do something continuously
this.renderer.zoomIn();
}, 100);
return false;
};
zoomMouseUp = () => {
clearInterval(this.timeout);
return false;
};