How to use the el-input component to remove the browser's automatic filling of account passwords

1. Only prohibit the automatic filling of passwords saved by the browser when the input type="password"

1. Use the attribute auto-complete (available in version 2) that comes with el-input in element, but the value cannot be changed to new-password according to the official website.

2. Use the read-only attribute of the el-input component (whether or not) readonly, and start to make the input box read-only, readonly = "true".

3. Register the focus event focus and control the attribute value (true, false) of readonly.

The specific code is as follows:

The code on the component is shown in the figure:

The event code is as follows: (define readonlyFlag=true in data())

2. When the input type="password", cancel the pop-up of the browser save password box (if it does not pop up, the first problem will be solved naturally, the disadvantage is that there is no way to use the show-password attribute)

The situation where the problem is encountered is as follows:

Solution: (this method treats the symptoms but not the root cause, and can achieve the effect of solving the above problems) 

Guess you like

Origin blog.csdn.net/weixin_44191318/article/details/125386427