我正在尝试从flux store获取数据以在某些组件上呈现。如何在助焊剂店做到这一点。在这里,我添加了我尝试过的示例代码。
import EventEmitter from 'events';
var newData;
class EventLists extends EventEmitter {
getAll() {
$.ajax({
url:url,
type:'GET',
contentType: 'application/json; charset=UTF-8',
dataType:'json',
success:function(data) {
newData = data;
}
});
return newData;
}
};
const eventLists = new EventLists;
export default eventLists;