2015-06-22 64 views
0

我試圖讓登錄被點擊但沒有填充時彈出一個模式。莫代爾在Reactjs-bootstrap應用程序中不工作

我使用'react-bootstrap'庫。

下面是代碼:

var React = require('react'); 
var Modal = require('react-bootstrap'); 

var Login = React.createClass({ 
    render: function() { 
    return (
    <div className='static-modal'> 
     <Modal title='Modal title' 
      enforceFocus={false} 
      backdrop={false} 
      animation={false} 
      container={mountNode} 
      onRequestHide={function() {}}> 
      <div className='modal-body'> 
      One fine body... 
      </div> 
      <div className='modal-footer'> 
      <Button>Close</Button> 
      <Button bsStyle='primary'>Save changes</Button> 
      </div> 
     </Modal> 
     </div> 
    ); 
    } 
}); 


module.exports = Login; 

任何想法,爲什麼它沒有呈現?僅供參考,我也使用反應路由器路由通過組件。

+0

該代碼可能會拋出一個引用錯誤,因爲未定義變量'mountNode'。 –

+0

良好的捕獲 - 但是什麼會傳遞給容器爲模式來填充? – rahul2001

+1

我不知道,我不熟悉react-bootstrap。 –

回答

0

通過this在集裝箱道具。它會掛載你的模態 container={this}