解决方案:只需要添加onfocus="this.removeAttribute('readonly');" readonly
,就不会自动填充。大概意思就是初始化为只读,当聚焦时去掉只读属性,只读可以防止浏览器自动填充。
// 用户输入框
<el-input
v-model="userForm.name"
placeholder="请输入用户姓名"
readonly
onfocus="this.removeAttribute('readonly');"
></el-input>
// 密码输入框
<el-input
v-model="userForm.password"
maxlength="30"
show-password
placeholder="请输入登录密码""
></el-input>