简体   繁体   English

不显示来自 console.log 的数据

[英]Not displaying data from console.log

I'm working on a project in react, which I console.log a data and it shows, but when i try to display, its not working.我正在做一个反应项目,我控制台记录一个数据并显示它,但是当我尝试显示时,它不起作用。 I think im missing something.我想我错过了一些东西。 Its not displaying the length, id or body of the content它不显示内容的长度、ID 或正文

<Badge count={`${notify !== null ? notify.length : 0}`} overflowCount={10}>
                        <Dropdown 
                        overlay={<Menu>
                            {notify && notify.map(notify => {
                                return (
                            <Menu.Item key={notify.id}>
                              <a href="#">{notify.body}</a>
                            </Menu.Item>
                                );
                            })}
                            {notify && notify.length < 1 ? (
                                <Menu.Item>No notifications yet</Menu.Item>

                            ) : null }

                            <Menu.Divider />
                            <Menu.Item onClick={() =>
                              this.props.history.push("/notifications")
                            }>
                             <a href="#">VIEW ALL <ArrowRightOutlined /></a></Menu.Item>
                          </Menu>
                          } 
                        trigger={['click']}>
                            <a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
                                <BellOutlined style={{ fontSize: '25px', color: '#2aa515' }}/>                            
                            </a>
                        </Dropdown>
                    </Badge>

This is the data from the console.log这是来自 console.log 的数据

(21) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0:
assigned_to: 4
body: "tayodami followed you! ID: 12"
creation_date: "2020-10-10T19:41:23.428773Z"
group: "NF"
id: 21
is_read: true
pk_relation: 12
__proto__: Object
1: {id: 22, group: "NF", creation_date: "2020-10-10T19:43:27.537867Z", is_read: true, body: "que followed you! ID: 13", …}
2: {id: 23, group: "NF", creation_date: "2020-10-10T20:05:06.098263Z", is_read: true, body: "oladeji followed you! ID: 14", …}
3: {id: 24, group: "NF", creation_date: "2020-10-11T05:41:46.792794Z", is_read: true, body: "oladeji followed you!", …}
4: {id: 25, group: "NC", creation_date: "2020-10-11T10:39:02.069264Z", is_read: true, body: "que commented: asfasf.", …}
5: {id: 26, group: "NC", creation_date: "2020-10-11T10:40:26.915029Z", is_read: true, body: "que commented: asfasf.", …}
6: {id: 28, group: "NC", creation_date: "2020-10-11T11:36:50.180718Z", is_read: true, body: "que commented: hi.", …}
7: {id: 29, group: "NC", creation_date: "2020-10-11T11:45:38.079017Z", is_read: true, body: "que commented: gg on your post.", …}
8: {id: 31, group: "NC", creation_date: "2020-10-12T11:46:50.121499Z", is_read: true, body: "que commented: hi on your post.", …}
9: {id: 32, group: "NC", creation_date: "2020-10-12T11:50:42.081770Z", is_read: true, body: "que commented: "TODAY" on your pop.", …}
...
length: 21
__proto__: Array(0)

Use console.dir() instead of.log() to get all fields.使用 console.dir() 而不是 .log() 来获取所有字段。

https://developer.mozilla.org/en-US/docs/Web/API/Console/dirhttps://developer.mozilla.org/en-US/docs/Web/API/Console/dir

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM