Benefits • Interface for data mapping: the front page does not require custom fields and fields of the same back-end, front-end back-end modify the field will not be affected.
· Res to get the data from the interface:
let r = res.map(item => {
return {
title: item.name,
sex: item.sex === 1? '男':item.sex === 0?'女':'保密',
age: item.age,
avatar: item.img
}
})
· May be omitted return:
const users=res.items.map(item => ({
url: item.html_url,
img: item.avatar_url,
name: item.login,
})
);