下面的代码引用了一个组件函数,该函数从url获取数据,并try 将该数据设置为属性.它不起作用,似乎this
无法从ajax clousure范围访问.
var MyComp = Vue.extend({
props: {
html_prop: {}
....
},
methods: {
fetchCondiciones: function(url){
$.ajax({
type: "GET",
url: url,
cache: false,
data: vardata ,
success: function(data,status,error) {
if( data!=''){
this.html_prop = data;
}
},
error: function(data,status,error){
alert(error);
}
});
}
...
}
})
我怎样才能让this
人进入?