this指向问题
mounted(){
let that=this;
let xhr=new XMLHttpRequest();
// xhr.responseType="json";
let user={name:"xiaoliu",password:123456};
// xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.open("POST","http://localhost:8080/");
user=JSON.stringify(user);
xhr.send(user);
xhr.onreadystatechange=function(){
if(xhr.readyState===4){
// let res=JSON.parse(xhr.response)
console.log("xhr.response",xhr.response);
let val = xhr.response;
that.msg = val;
// this.$forceUpdate();
// this.$set(this.msg,xhr.response)
console.log("this.msg",this.msg)
}
}
},