v-on:input="changeInputValue(submitinfo.password)"
auto-complete="new-password"
注意現在這塊這個input框已經不是密碼框而是一個文本框,因為密碼框記住賬號的功能是瀏覽器自帶的功能,只能用這種掩蓋得方式解決這個問題
changeInputValue(strVal){ //如果點擊了刪除得按鈕,則清空realOldPassword if(strVal === ""){ this.realOldPassword = ""; } //js將一個字符串里所有得*去掉 let str = strVal.replace(/[*]/g,""); if(str === ""){//如果輸入內容是空則刪除以為 this.realOldPassword=this.realOldPassword.slice(0,this.realOldPassword.length-1); }else{//否則增加一位 this.realOldPassword+=strVal.substr(strVal.length-1,1); //獲取最后一個字符加到到str,因為除了最后一個字符,其他的已經為* } this.submitinfo.password=strVal.replace(/./g,'*') //輸入框內容全部變為* // console.log(this.realOldPassword,111) // console.log(this.submitinfo.password,222) },