与ReactJS兼容(如何从ReactJS组件调用jQuery插件?)
我正在从非ReactJS应用程序(主要使用jQuery)切换到ReactJS 到目前为止,这个迁移没有问题,但我的应用程序使用的是“FooTable jQuery插件”与ReactJS兼容(如何从ReactJS组件调用jQuery插件?),jquery,reactjs,jquery-plugins,footable,Jquery,Reactjs,Jquery Plugins,Footable,我正在从非ReactJS应用程序(主要使用jQuery)切换到ReactJS 到目前为止,这个迁移没有问题,但我的应用程序使用的是“FooTable jQuery插件” 有效。这篇文章救了我 我使用了refs和componentDidUpdate() componentDidUpdate:函数(prevProps、prevState){ jQuery(ReactDOM.findDOMNode(this.refs.sampletable)).footable(); }, <table
有效。这篇文章救了我 我使用了refs和componentDidUpdate()
componentDidUpdate:函数(prevProps、prevState){
jQuery(ReactDOM.findDOMNode(this.refs.sampletable)).footable();
},
<table class="footable">
<thead>
<tr>
<th data-class="expand">Name</th>
<th data-hide="phone,tablet">Phone</th>
<th data-hide="phone">Zip</th>
<th data-hide="phone">Address</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ken</td>
<td>00-1234-5678</td>
<td>110-0006</td>
<td>Tokyo</td>
</tr>
<tr>
<td>Hanako</td>
<td>11-2345-6789</td>
<td>550-0026</td>
<td>Osaka</td>
</tr>
<tr>
<td>Ichiro</td>
<td>22-3456-7890</td>
<td>812-0002</td>
<td>Fukuoka</td>
</tr>
<tr>
<td>Sato</td>
<td>22-3456-7890</td>
<td>468-0836</td>
<td>Aichi</td>
</tr>
</tbody>
</table>
$(function() {
$('table').footable();
});
componentDidUpdate: function(prevProps, prevState) {
jQuery(ReactDOM.findDOMNode(this.refs.sampletable)).footable();
},
<table ref="sampletable">