匯入專案,模組的依賴全部報紅
阿新 • • 發佈:2021-08-28
mounted(){
letthat=this;
letxhr=newXMLHttpRequest();
//xhr.responseType="json";
letuser={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){
//letres=JSON.parse(xhr.response)
console.log("xhr.response",xhr.response);
letval=xhr.response; that.msg=val; //this.$forceUpdate(); //this.$set(this.msg,xhr.response) console.log("this.msg",this.msg) } } },
letval=xhr.response; that.msg=val; //this.$forceUpdate(); //this.$set(this.msg,xhr.response) console.log("this.msg",this.msg) } } },