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

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

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

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

相关推荐
笃行3506 小时前
集中式与分布式,KingbaseES 的四种形态共用一套内核
前端
陈随易8 小时前
Vue 编译器换掉 source map,快了三四成
前端·后端·程序员
ZhengEnCi9 小时前
12 种高级 UI 交互效果及对应 AI 提示词:从按压回弹到底部抽屉的物理感教学
前端·css·交互设计
IT_陈寒12 小时前
Redis大key删除为什么会导致服务卡顿?我的线上事故复盘
前端·人工智能·后端
用户27050777252412 小时前
MCP 最小 Server 实测:3 个 JSON-RPC 报错与修法
前端
用户4993350250712 小时前
一人VIP账号多人共用:Web 代理里的会话共享怎么实现
前端
用户老李12 小时前
无线电自学教程 05:第一台收音机——从矿石机到 SDR
前端
IPIPD12 小时前
Node.js请求遇到503怎么重试?先解析Retry-After,再做有上限退避
前端
葡萄城技术团队13 小时前
dsh-spreadjs-editor 的集成链路:把 SpreadJS Designer 嵌进 Agent 工作台
前端
FlyWIHTSKY13 小时前
vue2和vue3有什么区别,用法上有哪些区别
前端·javascript·vue.js