数秒 read (About 79 words)
JavaScriptでのダブルクリック処理の実装方法
コード
1 2 3 4 5
| data: { delay: 500, clicks: 0, timer: null },
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| click_one(){ this.clicks++ if(this.clicks === 1) { var self = this this.timer = setTimeout(function() { self.clicks = 0 }, this.delay); } else{ clearTimeout(this.timer); this.clicks = 0; } },
|
参考
https://stackoverflow.com/questions/41303982/vue-js-how-to-handle-click-and-dblclick-events-on-same-element/56046910