验证码自动更改输入

Captcha auto-change on input

我正在使用 reactjs 和 antdesign 处理带有验证码的表单,我的问题是当我在其他字段上键入时,验证码发生变化。

希望你理解我..

谢谢

codesandbox

<FormItem>
    <Input
    prefix={<Icon type="key" style={{ color: "rgba(0,0,0,.25)" }} />}
    type="captcha"
    placeholder="captcha"
    addonAfter={<Captcha />}
    />
</FormItem>

ReactJS 中:re-rendering 可以通过 shouldComponentUpdate()returning false.

disabled

请参阅下面的实际示例。

请参阅 this fork of your CodeSandbox 了解可行的解决方案。

// Captcha.
class Captcha extends Component {

  // Render.
  render = () => (
    <div className="Captcha">
      <NumberList />
    </div>
  )

  // Should Component Update.
  shouldComponentUpdate = () => false

}