如何禁用 React antd 中的复制粘贴事件?

Shr*_*vas -2 javascript reactjs antd

我在我的 React 应用程序中使用 Ant Design Forms。我想知道如何防止用户复制并粘贴该输入字段中的值。

小智 18

import { Input } from "antd";
Run Code Online (Sandbox Code Playgroud)
<Input onPaste={(e)=>{
      e.preventDefault()
      return false;
    }} onCopy={(e)=>{
      e.preventDefault()
      return false;
    }} placeholder="Basic usage" />
Run Code Online (Sandbox Code Playgroud)