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

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

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

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

相关推荐
你听得到1116 小时前
用户说 App 卡,但说不清在哪?我把 Flutter 监控 SDK 升级成了链路观测工作台
前端·flutter·性能优化
天渺工作室1 天前
实现一个adblock/adblock plus等浏览器广告拦截器检测插件
前端·javascript
阳光是sunny1 天前
Vue 项目怎么做用户行为全链路监控?轻量插件方案详解
前端·面试·架构
ZhengEnCi1 天前
Q04-Vite禁用CSS代码分割-解决生产环境样式加载顺序混乱问题
前端·vue.js·vite
九酒1 天前
AI Agent 开发踩坑记:口播功能非得用 APP 原生实现吗?
前端·人工智能·agent
Jackson__1 天前
做了一段时间的AI coding后,我终于搞清了 CLI 和 MCP 的区别
前端·agent·ai编程
IT_陈寒1 天前
JavaScript项目实战经验分享
前端·人工智能·后端
用户47949283569151 天前
6w star,GitHub 趋势第一的 Ponytail,这个agent插件到底在火什么
前端·后端
薛定喵的谔1 天前
我开源了一个精致的 Next.js 博客模板:Skyplume
前端·前端框架·next.js