两次密码输入不正确,点击弹窗的确定为什么还是跳转到登录页面了
<script> export default { name: 'login', data() { return { Login: false, loginName: '', password: '', affirm: '' } }, methods: { myLogin: function () { if (localStorage.getItem("loginName") === this.loginName && localStorage.getItem("password") === this.password) { this.$router.push('/home/list') } else { alert("密码用户名错误!!") } }, reg: function () { this.Login = true }, cancel: function () { this.Login = false }, addUser: function () { if (this.password === this.affirm && this.password != '' && this.affirm != '') { localStorage.setItem("loginName", this.loginName), localStorage.setItem("password", this.password), this.loginName = '', this.password = '', this.login = false } else { alert("两次密码输入不一致!!") } } } } </script>
密码输入不一致 已经弹出提示了但是点击确认后跳转到了登录页面,url地址栏多了个 /? 真的百思不得其解?