我正在尝试,material-ui
并且react
遇到了事件未触发的问题。我已安装并在引导应用程序时react-tap-event-plugin
调用。injectTapEventPlugin()
toggleMenu
在以下代码段中从未调用过:
/** @jsx React.DOM */
var React = require('react');
var mui = require('material-ui');
var LeftNav = mui.LeftNav;
var MenuItem = mui.MenuItem;
var AppBar = mui.AppBar;
var App = React.createClass({
getInitialState: function () {
return {
message: 'Hello World!'
};
},
toggleMenu: function () {
console.log('clicked hamburger'); //<-- This is never fired
this.refs.menu.toggle();
},
render: function() {
var menuItems = [{ route: 'get-started', text: 'Get Started' }];
return (
<div>
<AppBar onMenuIconButtonTouchTap = {this.toggleMenu} title = "Hej" />
<LeftNav ref = "menu" docked = {false} menuItems = {menuItems} />
</div>
);
}
});
module.exports = App;
完整的代码示例可以从这里查看:https ://github.com/oskbor/lunch-mirror
很高兴对我做错了什么提出任何建议!