当前位置: 首页 > Web前端 > vue.js

完美解决element-uiinput=password会在浏览器自动填写密码的问题

时间:2023-03-31 19:29:12 vue.js

changAttr/clickEvt方法changAttr(e,type){if(type==='focus'){if(e){e.stopPropagation();e.preventDefault();}setTimeout(()=>{this.readonly=false;},100);}否则{如果(e){e.stopPropagation();}this.readonly=true;}},clickEvt(){if(this.$refs.password){this.$refs.password.$refs.input.onmousedown=(evt)=>{if(evt){evt.preventDefault();evt.stopPropagation();}if(this.ruleForm.password===''||this.readonly){this.$refs.password.$refs.input.blur();setTimeout(()=>{this.$refs.password.$refs.input.focus();},0);}返回假;};}},详细