我正在实现React-Dragula库,以便在我的项目中进行简单的拖放。根据那里的示例代码,我知道每个元素应该是容器内的 div,但没有得到任何解决方案如何在我的代码中实现这一点。
这是代码-
import React, {Component, PropTypes} from 'react';
import ReactDOM from 'react-dom';
import dragula from 'react-dragula';
class NavBar extends Component {
componentDidMount () {
var container = ReactDOM.findDOMNode(this);
console.log("dcdscscsccscd", container)
console.log("NavBar.........................................")
dragula([container]);
}
render () {
return(
<div className="container">
<nav className="navbar navbar-static-top">
<div className="navbar-custom-menu">
<ul className="nav navbar-nav">
<li> <a href="#" className="dropdown-toggle" data- toggle="dropdown"> <i className="fa fa-search" aria-hidden="true"></i> Rate Search </a> </li>
<li> <a href="#" className="dropdown-toggle" data-toggle="dropdown"> <i className="fa fa-bar-chart" aria-hidden="true"></i> Negotiation Worksheet </a> </li>
</ul>
<ul className="nav navbar-nav pull-right">
<li> <a href="#" className="dropdown-toggle" data-toggle="dropdown"> <i className="fa fa-search" aria-hidden="true"></i> </a> </li>
<li> <a href="#" className="dropdown-toggle" data-toggle="dropdown"> <i className="fa fa-bell" aria-hidden="true"></i> <span className="label label-warning">2</span> </a> </li>
<li className="dropdown user user-menu dropdown" > <a href="#" className="dropdown-toggle" data-toggle="dropdown"> <i className="fa fa-user" aria-hidden="true"></i> </a>
<ul className="dropdown-menu user-info" role="menu" aria-labelledby="menu1">
<li className="user-header"> Jack Johnson </li>
<li><a href="#">My Account</a></li>
<li><a href="#">Preferences</a></li>
<li><a href="#">Logout</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
)}
}
export default NavBar;
请让我知道我做错了什么。感谢您提前提供任何帮助。