axios 内で this で自分を参照できないので self = this とかしていたけど、
created:function() {
const self = this;
axios
.get(_api_)
.then(
function(response) {
self.data = response.data;
}
)
}
.bind(this) する方がなんかかっこいい。
created:function() {
axios
.get(_api_)
.then(
function(response) {
this.data = response.data;
}.bind(this)
)
}
bind() なんて名前だから Vue.js のメソッドみたいですが JavaScript の関数。“特殊関数オブジェクト”とは??