刷新页面时不会调用React Component DidMount

时间:2015-08-05 13:41:27

标签: reactjs flux

我开发了它的外观,

 var ManageViewPage = React.createClass({
  // Get initial state from stores
  getInitialState: function() {
    return setViewData();
  },
  componentDidMount: function() {
    SystemMetaItemStore.CallSystemMetaItem("Views");
    ItemStore.addChangeListener(this._onChange);
    SystemMetaItemStore.addChangeListener(this._onChange);
      alert("Did mount");
  },
  // Remove change listers from stores
  componentWillUnmount: function() {
    ItemStore.removeChangeListener(this._onChange);
    SystemMetaItemStore.removeChangeListener(this._onChange);
    alert("Did Unmount");
  },


  preventDefault: function (event) {
    event.preventDefault();
  },
  DeleteViewclick:function(event)
  {

  },
  render: function() {
    return (
      <div className="row">

      </div>
)
},

_onChange: function() {
  this.setState(setViewData());
}

});
module.exports =ManageViewPage;

当我第一次使用路由调用此页面时,它会调用警报“挂载”但是当我按F5刷新浏览器时它不会调用警报“挂载”所以任何人都可以指导我做了什么这里错了吗?

0 个答案:

没有答案