在React

时间:2015-12-05 00:42:23

标签: reactjs material-ui

我正在尝试使用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

1 个答案:

答案 0 :(得分:2)

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

你需要打电话 injectTapEventPlugin();