[英]How to disable Paste (Ctrl+V) and Copy(Ctrl+C)in a TextField of MaterialUI
How can I disable Paste (Ctrl+V) and Copy (Ctrl+C) option in one of my TextFields of MaterialUI?如何在 MaterialUI 的 TextField 之一中禁用粘贴 (Ctrl+V) 和复制 (Ctrl+C) 选项?
Iḿ using ReactJs我ḿ 使用 ReactJs
onCopy onCut onPaste are keyboard events. onCopy onCut onPaste 是键盘事件。 The below code is the sample.
下面的代码是示例。 you got the idea.
你明白了。 The reference in react docs is below.
反应文档中的参考如下。
Good Luck祝你好运
https://reactjs.org/docs/events.html#keyboard-events https://reactjs.org/docs/events.html#keyboard-events
const handleChange = (e) => {
e.preventDefault();
};
<TextField
value={val}
onCut={handleChange}
onCopy={handleChange}
onPaste={handleChange}
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.