antd在處理瀏覽器自動填充的問題時候,加input屬性autocomplete = off或者autocomplete =‘new-password’並不能解決問題
網上有一種解決方案比較靠譜:就是state加當前密碼框的屬性,點擊表單之后再去修改屬性值為password. 感覺比較復雜!
其實:一行代碼就可以解決.
<>
<Input style={{ height: '0px', width: '0px', overflow: 'hidden', padding: '0px', border: 'none', position: 'absolute' }} maxLength={11} />
<FormItem label="登錄密碼" {...this.formLayout}>
{getFieldDecorator('password', {
rules: [
{
required: true,
message: '請輸入登錄密碼',
},
],
initialValue: '000000',
})(<Input.Password password placeholder="請輸入" style={{ width: '100%' }} />)}
</FormItem>
</>
完整用例
isEdit是指當前是否是修改!
其實就是欺騙瀏覽器.哈哈哈哈哈!!!!