【发布时间】:2022-12-17 02:44:50
【问题描述】:
我在 react js 中有一个 onClick 函数,现在我想用 e.target 参数传递多个参数。如果我使用多个参数,则 e.target 无法正常工作。这个怎么做?
我的代码:-
export const App = () => {
const move_box_click = (x, y, boxHeight, boxWidth, e) => {
console.log(x, y, boxHeight, boxWidth);
console.log (e.target.id)
};
return(
<>
<input
type="input"
name={name}
value={value}
onClick={()=>move_box_click(100, 95, 30, 100)}
/>
</>
)
}
感谢您的努力!
【问题讨论】:
标签: javascript reactjs