要读取接口返回值中的Symbol(ORIGIN_RESPONSE)属性的内容,可以使用以下步骤:
// 假设接口返回值为 response
const response = { [Symbol('ORIGIN_RESPONSE')]: { data: { a: 123 } } };
// 获取Symbol(ORIGIN_RESPONSE)属性的键
const symbolKey = Object.getOwnPropertySymbols(response)[0];
// 通过symbolKey访问Symbol(ORIGIN_RESPONSE)属性的内容
const content = response[symbolKey];
// 输出内容
console.log(content); // { data: { a: 123 } }
console.log(content.data.a); // 123
在上述示例中,我们假设接口返回值为response对象,其中包含Symbol(ORIGIN_RESPONSE)属性。我们使用Object.getOwnPropertySymbols()方法获取所有Symbol属性的键,然后通过获取的键访问Symbol(ORIGIN_RESPONSE)的内容。最后,我们可以按需访问内容的子属性。请注意,Object.getOwnPropertySymbols()方法返回的是一个数组,我们通过索引[0]来获取第一个Symbol属性的键。如果有多个Symbol属性,你可以根据需求来处理。