when using axios to interact with the background, sometimes the background cannot receive the value, or the data received is not in the correct format.
I use URLSearchParams to process the parameters
var params = new URLSearchParams();
params.append("is_iso", "1");
params.append("phone", self.ruleForm.username);
params.append("password", self.ruleForm.password);
this.$axios({
method: "post",
url:httpUrl.SellerLogin,
data:params
}).then((res)=>{
console.log(res.data);
if(res.data.errCode==0){
sessionStorage.setItem("ms_username",self.ruleForm.username);
sessionStorage.setItem("uid",res.data.retData.uid);
self.$router.push("/readme");
}else if(res.data.errCode==1){
console.log(res.data);
this.$alert(res.data.retData.msg, "", {
confirmButtonText: "",
type: "error",
center: true
});
self.ruleForm.username = "";
self.ruleForm.password = "";
self.ruleForm.identifycode = "";
}
});
but the compatibility of URLSearchParams is not high. It is completely incompatible with ie and edge browsers.
do you know how to solve the compatibility problems of axios URLSearchParams IE and Edge browsers?