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

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

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

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

相关推荐
小雨下雨的雨15 分钟前
鸿蒙PC用Electron框架——Canvas蜡笔抖动效果实现技术深度解析
前端·javascript·华为·electron·鸿蒙系统
ZC跨境爬虫17 分钟前
跟着 MDN 学CSS day_49:定位实例练习从入门到精通
前端·css·学习
前端小万17 分钟前
用AI两小时开发上架的小程序,单日新增用户173
前端·微信小程序
道友可好21 分钟前
Spec Kit:GitHub 官方出品,规范即代码
前端·人工智能·后端
木斯佳25 分钟前
前端八股文面经大全:磐松私募-27届前端实习一面(2026-05-27)·面经深度解析
前端
薛先生_09929 分钟前
声明式导航(route-link)(跳转传参)
前端
郑州光合科技余经理33 分钟前
海外版外卖系统:如何快速搭建国际化外卖平台
java·开发语言·前端·人工智能·小程序·系统架构·php
小雨下雨的雨41 分钟前
蜡笔小画家鸿蒙PC用Electron框架 - 儿童学画蜡笔画技术实现详解
前端·javascript·华为·electron·前端框架·交互·鸿蒙系统
天蓝色的鱼鱼41 分钟前
别只拿 Playwright 写测试,这三个野路子用法才是真香
前端
SoaringHeart44 分钟前
Flutter进阶|源码修改:DecorationImage 添加网络图片占位图
前端·flutter