- recently used Vue as the login page. After entering the account number and password, I clicked on the login to refresh it. Inexplicably, I added an extra question mark at the back of my path. I printed it but did not print it out in the code, but it was printed out when I clicked the second time. After printing, I gave the route jump, and finally the route jump could not be performed. Secondly, I used debugger to debug. My current judgment didn"t go in. It"s strange that it can print and debug with debugger without executing
html
<div class="login_form">
<el-form :label-position="labelPosition" label-width="80px" :model="form">
<el-form-item>
<i class="account_icon"></i>
<el-input v-model="form.userName" placeholder="" auto-complete="off"></el-input>
</el-form-item>
<el-form-item prop="password">
<i class="password_icon"></i>
<el-input type="password" v-model="form.password" auto-complete="off" placeholder=""></el-input>
</el-form-item>
<div class="checkbox">
<input type="checkbox">
<span class="login_password"></span>
</div>
<div>
<button @click="onSubmit" :plain="true"></button>
</div>
<div class="login_embellish">
<i class="embellish_one"></i>
</div>
</el-form>
<i class="modifier_left"></i>
<i class="modifier_right"></i>
</div>
js
export default {
data() {
return {
labelPosition: "right",
form: {
userName: "admin",
password: "admin123"
},
};
},
methods: {
//
onSubmit() {
let paramsData = {
username: this.form.userName,
password: this.form.password
};
debugger
this.$ajax.post(this.$api.Login, paramsData).then(res => {
if (res.data.status == 200) {
console.log("res", res);
let params = "";
localStorage.params = JSON.stringify(res.data.data);
localStorage.setItem("params",localStorage.params);
this.$router.push({ path: "/index" })
}else if(res.data.status == 401) {
this.$message.error(res.data.message);
}
})
.catch(err => {
console.log(err);
})
}
}
}
- the first click to log in is refreshed, with an extra question mark at the end of the path
- ,
4.debugger,