Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在屏幕上有多个按钮,我希望该用户单击此按钮以路由到新项目,或者用户可以关闭它,因为我在按钮内给出了关闭图标,以便用户可以根据需要关闭它,但是当我试图为按钮内的图标提供 onclick 功能时,它不起作用
我怎么能这样做???
这是演示代码
https://codesandbox.io/s/material-demo-rbkr8
尝试用这样的 div onClick 包装它?
const doSomething = () => { alert('click here'); } <div onClick={doSomething}> <DeleteIcon className={classes.rightIcon} /> </div>