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

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

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;
}

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

相关推荐
天蓝色的鱼鱼3 分钟前
前端开发必装 Skill 清单:让你的 AI 编程体验原地起飞
前端·ai编程·claude
Mike_jia10 分钟前
TrendRadar:开源趋势监控工具
前端
GISer_Jing11 分钟前
BOSS上AIAgent|前端AI所需要技能
前端·人工智能·ai·前端框架
西洼工作室14 分钟前
UniApp开发全攻略:从生命周期到路由传值
前端·javascript·uni-app
LaughingZhu19 分钟前
Product Hunt 每日热榜 | 2026-05-17
前端·人工智能·chatgpt·html
Cobyte21 分钟前
Agent Skills 系统的本质原理
前端·aigc·ai编程
星恒随风22 分钟前
四天学完前端基础三件套(JavaScript webAPI篇)
开发语言·前端·javascript
IT_陈寒26 分钟前
Redis突然吃掉所有内存,我的服务差点挂了
前端·人工智能·后端
2601_9584925526 分钟前
Behavioral Analysis of HTML5 Trivia Integration
前端·html·html5