我试图在我的checkForUrgentEvents方法中获取特定的对象属性并返回它。不用引用我当前的方式,而是可以找到特定的属性?我尝试了Object.hasownproperty,但是由于它嵌套得很深,所以无法正常工作。
private checkForUrgentEvents(urgentEventsData: any, query:CurrentContentParams) {
return urgentEventsData.data.Data[
query.type + caasConfig.urgentContentIdSuffix
].content[query.id];
}
// urgentEventsData:
{ status: 200,
statusText: 'OK',
headers:
{ connection: 'close',
'transfer-encoding': 'chunked' },
config:
{ adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
method: 'get',
data:
{ LatestModified: 1555080079154,
Results: 1,
Error: '',
Data: { faqsurgentcontent: [Object] } } }
//query:
{ id: 'MAIN', type: 'faqs' }
芜湖不芜
江户川乱折腾
相关分类