8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
背景:如果有元素的点击事件中阻止了冒泡,会导致 useClickAway 无法捕捉到此次点击
useClickAway
代码:
import React, { useState, useRef } from "react"; import { useClickAway } from "ahooks"; export default () => { const [counter, setCounter] = useState(0); const ref = useRef<HTMLButtonElement>(null); useClickAway(() => setCounter((s) => s + 1), ref); return ( <div> <button ref={ref} type="button"> box1 </button> <button type="button" style={{ marginLeft: 16 }} onClick={(e) => e.stopPropagation()} > box2 </button> <p>counter: {counter}</p> </div> ); };
期望:支持传入事件监听选项如 capture 等参数,改变事件捕获时机
The text was updated successfully, but these errors were encountered:
No branches or pull requests
背景:如果有元素的点击事件中阻止了冒泡,会导致
useClickAway
无法捕捉到此次点击代码:
期望:支持传入事件监听选项如 capture 等参数,改变事件捕获时机
The text was updated successfully, but these errors were encountered: