相关疑难解决方法(0)

在react.js中渲染后滚动到页面顶部

我有一个问题,我没有想法,如何解决.在我的react组件中,我显示了一长串数据,底部显示了很少的链接.点击任何链接后,我用新的链接集合填写列表,需要滚动到顶部.

问题是 - 如何渲染新集合滚动到顶部?

'use strict';

// url of this component is #/:checklistId/:sectionId

var React = require('react'),
  Router = require('react-router'),
  sectionStore = require('./../stores/checklist-section-store');


function updateStateFromProps() {
  var self = this;
  sectionStore.getChecklistSectionContent({
    checklistId: this.getParams().checklistId,
    sectionId: this.getParams().sectionId
  }).then(function (section) {
    self.setState({
      section,
      componentReady: true
    });
  });

    this.setState({componentReady: false});
 }

var Checklist = React.createClass({
  mixins: [Router.State],

  componentWillMount: function () {
    updateStateFromProps.call(this);
  },

  componentWillReceiveProps(){
    updateStateFromProps.call(this);
   },

render: function () {
  if (this.state.componentReady) {
    return(
      <section className='checklist-section'>
        <header className='section-header'>{ this.state.section.name } …
Run Code Online (Sandbox Code Playgroud)

scroll render reactjs

135
推荐指数
23
解决办法
16万
查看次数

标签 统计

reactjs ×1

render ×1

scroll ×1