# 手機端javascript無法使用dbclick功能 解決辦法 ###### tags: `Vue` `JavaScript` `dblclick` ## @dblclick.native="doSomething()" 問題:在手機上沒反應 解決辦法:用setTimeout去計算在500ms內,點擊了兩次才執行 範例: ``` @click="clickTwice(1)" data() { return { double_click_count: 0 }; }, methods: { clickTwice(num) { this.double_click_count = this.double_click_count + num; setTimeout(() => { this.double_click_count = 0; }, 500); if (this.double_click_count == 2) { doSomething.... } } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up