怎么解决, 提示在定义的Vue axios方法的回调函数内部调用不到定义的属性weatherList
const app = new Vue({
el: "#app",
data: {
city: '',
weatherList: [],
},
methods: {
searchWeather: function () {
//保存this
const that = this;
//调用接口
axios.get('http://wthrcdn.etouch.cn/weather_mini?city=' + this.city)
.then(function (response) {
that.weatherList = response.data.data.forecast;
})
.catch(function (err) { console.log(err); }
)
}
},
})