项目未在React组件中呈现

时间:2015-07-28 03:32:25

标签: javascript reactjs material-ui

我正在使用React和Material-UI。我没有收到任何错误,但带有信息的组件没有显示任何内容

import React from "react";
import { RouteHandler } from "react-router";
import MainMenu from "components/MainMenu";
import _ from "lodash";
import mui, { RaisedButton, AppBar,  FlatButton, Toolbar,
                            ToolbarGroup, DropDownMenu, ToolbarTitle, FontIcon,
                            DropDownIcon, ToolbarSeparator} from 'material-ui';

let ThemeManager = new mui.Styles.ThemeManager();

import styles from "./Application.css";

let filterOptions = [
  { payload: '1', text: 'All Broadcasts' },
  { payload: '2', text: 'All Voice' },
  { payload: '3', text: 'All Text' },
  { payload: '4', text: 'Complete Voice' },
  { payload: '5', text: 'Complete Text' },
  { payload: '6', text: 'Active Voice' },
  { payload: '7', text: 'Active Text' },
];
let iconMenuItems = [
  { payload: '1', text: 'Download' },
  { payload: '2', text: 'More Info' }
];

export default class Application extends React.Component {
  childContextTypes: {
    muiTheme: React.PropTypes.object
  }

  getChildContext() {
    return {
      muiTheme: ThemeManager.getCurrentTheme()
    };
  }

    static getProps(stores, params) {
        var transition = stores.Router.getItem("transition");
        return {
            loading: !!transition
        };
    }
    render() {
        var { loading } = this.props;
        return <div className={styles.this + (loading ? " " + styles.loading : "")}>
            <Toolbar>
              <ToolbarGroup key={0} float="left">
                <DropDownMenu menuItems={filterOptions} />
              </ToolbarGroup>
              <ToolbarGroup key={1} float="right">
                <ToolbarTitle text="Options" />
                <FontIcon className="mui-icon-sort" />
                <DropDownIcon iconClassName="icon-navigation-expand-more" menuItems={iconMenuItems} />
                <ToolbarSeparator/>
                <RaisedButton label="Create Broadcast" primary={true} />
              </ToolbarGroup>
            </Toolbar>
              <br />                
            <div className={styles.loadingElement}>loading...</div>
            <MainMenu />
            <RouteHandler />
        </div>;
    }
}

Application.contextTypes = {
    stores: React.PropTypes.object
};

Application.childContextTypes = {
  muiTheme: React.PropTypes.object
};

filterOptionsiconMenuItems未呈现,但其余的都可以。

0 个答案:

没有答案