Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using Antd dropdown menu component with a JSON, I want to create a dynamic menu that changes depending on my JSON (that I am fetching using express)(我正在使用带有JSON的Antd下拉菜单组件,我想创建一个动态菜单,该菜单根据我的JSON进行更改(我正在使用express获取))

so far I have(到目前为止,我有)

    const menu = (
  <Menu onClick={onClick}>
    {
    this.state.getSoftware.map((data,i) => (<Menu.item key={i}>{data.Name}</Menu.item>))
    }
  </Menu>
);

but this does not seem to be working, any help would be great!(但这似乎不起作用,任何帮助都将非常有用!)

  ask by johnest translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
506 views
Welcome To Ask or Share your Answers For Others

1 Answer

It's Menu.Item not Menu.item(它是Menu.Item而不是Menu.item)

<Menu onClick={this.onClick}>
        {this.state.getSoftware.map((data, i) => (
          <Menu.Item key={i}>{data.Name}</Menu.Item>
        ))}
      </Menu>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...