浏览器input自动填充

浏览器记住密码之后,账号密码框自动填充到input当中,输入框的背景色为白色,color为黑色,目标是去除这些自动填充之后的默认样式。
在reset.css当中写入填充后的样式

input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill,
input:-webkit-autofill:hover,
textarea:-webkit-autofill:hover,
select:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus,
select:-webkit-autofill:focus{
-webkit-text-fill-color: #ededed !important;
-webkit-box-shadow: 0 0 0px 1000px transparent inset !important;
box-shadow: 0 0 0px 1000px transparent inset !important;
background-color: transparent!important;
background-image: none;
transition: background-color 99999s ease-in-out 99999s;
-webkit-transition: background-color 99999s ease-in-out 99999s;
-webkit-transition-delay: 99999s;
transition-delay: 99999s;
}
input:-internal-autofill-selected {
/* -webkit-text-fill-color: transparent!important; */
transition: background-color 99999s ease-in-out 99999s!important;
-webkit-transition: background-color 99999s ease-in-out 9999s!important;
background-color: transparent!important;
background-image: transparent !important;
color: -internal-light-dark-color(black, white) !important;
}
input:autofill{
background:transparent;
}
input {
background-color: transparent;
}

input::-webkit-input-safebox-button{
display: none;/去掉搜狗浏览器密码软盘/
}
还有一个坑爹的搜狗浏览器自动填充去不掉网上我能搜到的都试了没用,如果有大神知道麻烦教教我
https://www.cnblogs.com/rubylouvre/p/5109300.html

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
在使用Vue框架的el-input组件时,浏览器自动填充可能会造成一些问题。浏览器自动填充浏览器根据用户之前的输入记录和记住密码等信息自动填充输入框内容的功能。但是这个功能也许不符合我们的需求,所以需要解决这个问题。 解决浏览器自动填充的方法有以下几种: 1. 屏蔽自动填充:可以通过设置input标签的autocomplete属性为off来禁止自动填充。 ```html <el-input v-model="inputValue" :autocomplete="'off'" ></el-input> ``` 2. 修改input事件:通过监听input事件,手动更新数据模型中的值,这样可以覆盖浏览器自动填充的内容。 ```html <el-input v-model="inputValue" @input="handleInput" ></el-input> ``` ```javascript methods: { handleInput() { this.inputValue = this.$refs.input.value; // 获取input框的值并更新数据模型 }, }, ``` 3. 利用setTimeout延迟设置值:使用setTimeout可以使得设置值操作在下一次事件循环开始,从而避免被浏览器自动填充的值覆盖。 ```javascript mounted() { setTimeout(() => { this.inputValue = ''; }, 0); }, ``` 4. 结合JavaScript和Vue的解决方案:在mounted钩子函数中使用JavaScript的代码将input框的值清空,并将其焦点移至其他input元素。 ```javascript mounted() { let input = document.getElementById('inputId'); input.value = ''; let otherInput = document.getElementById('otherInputId'); otherInput.focus(); }, ``` 这些方法可以有效解决浏览器自动填充所带来的问题,根据需要选择适合的解决方案即可。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值