JS/TS 对象转成JSON string 字符串
过滤其中的部分项
allMenu.value.forEach((_item) => {
console.log(JSON.stringify(_item, ['menuId']))
})
console.log(JSON.stringify(_item, ['menuId', 'menuName']))
一下方法需要进一步核对,没有调试通过
console.log(JSON.stringify(_item,replacer))
function replacer(key: string, value: string) {
elHelper.alertBox('key=' + key)
if (key === 'menuId') {
return value
}
return undefined
}