禁止浏览器自动填充密码功能,设置自动填充背景色。

禁止浏览器自动填充密码功能,设置自动填充背景色

1、禁止浏览器自动填充密码功能

text设置autocomplete="off"
password设置 autocomplete="new-password"

两个一起设置,就不会自动填充了。

javascript 复制代码
<el-input
   ref="username"
   class="my-input"
   v-model="loginForm.username"
   placeholder="账号/手机号"
   name="username"
   type="text"
   tabindex="1"
   autocomplete="off"
 />
 <el-input
   class="my-input"
   ref="password"
   v-model="loginForm.password"
   :type="passwordType"
   placeholder="密码"
   name="password"
   tabindex="2"
   autocomplete="new-password"
   @keyup.enter.native="handleLogin"
 />

2、设置自动填充背景色(阴影效果)

自动填充后,阴影颜色变为黑色。 需要设置为0,不显示阴影。

css 复制代码
.my-input .el-input__inner:-webkit-autofill,
.my-input .el-input__inner:-webkit-autofill:hover,
.my-input .el-input__inner:-webkit-autofill:focus,
.my-input .el-input__inner:-webkit-autofill:active {
    -webkit-text-fill-color: #fff !important;
    transition: background-color 5000s ease-in-out 0s;
    box-shadow: 0 0 0 0px inset !important;
}

设置完后,自动填充没有阴影了。

相关推荐
月光下的丝瓜7 小时前
Flutter 国内安装指南
前端·flutter
玄星啊7 小时前
AI 编程的第 30 天,我怀念古法 Coding 了
前端·ai编程
Jolyne_7 小时前
Angular基础速通
前端·angular.js
锋行天下8 小时前
半秒开!还有谁!!!
前端·vue.js·架构
代码搬运媛9 小时前
git 下中文文件名乱码问题解决
前端
CaffeinePro9 小时前
告别知识点零散!React零基础通关,从环境搭建到Ant Design页面实战
前端·react.js
cidy_989 小时前
水龙头领不到测试币?手把手用 Hardhat 本地环境零门槛学以太坊交易
前端
因_崔斯汀10 小时前
Three.js 3D 地图特效与材质实现指南
前端
angerdream10 小时前
手把手编写儿童手机远程监控App之vue3用 AI Agent生成菜单
前端
cidy_9810 小时前
Git Pull 代码冲突后完整回退教程
前端