今天在写一段代码
犯了个很简单的错误,
axios.post('/app/invite/find', {
inviteCode: this.code,
})
.then(res=> {
if (res.data.code===200) {
console.log(res.data.data[0]);
this.coupon_data=res.data.data[0]
this.ticketName=res.data.data[0].ticketName
this.ticketValue=res.data.data[0].ticketValue
this.effectValue=res.data.data[0].effectValue
this.endTime=res.data.data[0].endTime
}
这个是可以用this改变data里的值。then里面最好用箭头函数,不会改变this的指向,很简单的问题。。。