perfect-scrollbar
我在我的应用程序中使用的是旧版本React
。在旧版本中,ps.initialize()
我使用了一种方法,ref
用于我想使用完美滚动条的部分。
我尝试了新方法——见下文——但完美的滚动条似乎没有初始化。
import PerfectScrollbar from 'perfect-scrollbar';
class MyComponent extends Component {
componentDidMount() {
const sb1 = new PerfectScrollbar(this.refs.ref1);
const sb2 = new PerfectScrollbar(this.refs.ref2);
sb1.update();
sb2.update();
}
render() {
return(
<div ref="ref1">
Section 1
</div>
<div ref="ref2">
Section 2
</div>
);
}
}
export default MyComponent;
在应用程序中使用完美滚动条的正确方法是React
什么?顺便说一句,有一个完美滚动条的React Wrapper,但它已经有一段时间没有更新了,这个新更新的版本perfect-scrollbar
已经解决了旧版本的一些问题,所以我真的很想使用这个。我会很感激这里的一些指示。谢谢。