【问题标题】:Error using `DropdownMenu` of material-ui with React在 React 中使用 Material-ui 的“DropdownMenu”时出错
【发布时间】:2016-03-10 01:34:44
【问题描述】:

我正在尝试将http://www.material-ui.com/#/components/dropdown-menu 中的DropdownMenu 与此入门工具包https://github.com/kriasoft/react-starter-kit 一起使用。出现下拉菜单,但是当我单击它时,它不显示其列表。

这是我的步骤:

  1. npm install --save material-ui
  2. 将以下行添加到render() 中的ContactPage.js

    render() {
      const title = 'Contact Us';
      this.context.onSetTitle(title);
    
      let menuItems = [
        { payload: '1', text: 'Never' },
        { payload: '2', text: 'Every Night' },
        { payload: '3', text: 'Weeknights' },
        { payload: '4', text: 'Weekends' },
        { payload: '5', text: 'Weekly' },
      ];
      const DropDownMenu = require('material-ui/lib/drop-down-menu');
    
      return (
        <div className="ContactPage">
          <div className="ContactPage-container">
            <h1>{title}</h1>
            <p>...</p>
            <DropDownMenu menuItems={menuItems}/>
            <AceEditor />
          </div>
        </div>
      );
    }
    
  3. npm start

【问题讨论】:

标签: reactjs material-ui


【解决方案1】:

你看过http://www.material-ui.com/#/get-started/installation吗?

你需要打电话 injectTapEventPlugin();

【讨论】:

    猜你喜欢
    • 2021-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-25
    • 2018-06-06
    • 2021-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多