//This is a Route
function doSomething(){
var self=this;
var a,b,c;
//do something
reqArray="somevalue";
this.store.query("record",{"filter":"[{'api_name':'somevalue','comparator':'somevalue','value':"+reqArray+"}]"})
.then(function(data){
//can't access a,b,c or self
});
}
在promise函數解析後,我得到需要在then函數中的數據,但我無法訪問then函數之外的任何內容。
編輯更多的澄清:那麼函數內部的變量是window.i希望能夠引用的路線。無法訪問查詢函數內部的自變量
也可以訪問它。不會有任何問題。 –
'this'是'window'有 – Li357
那麼我將如何訪問自己在裏面DoSomething的呢?在功能上 –