Skip to content

为什么修改state没效果?rate #48

Description

@q1457797371

`
render() {
console.log(this);
console.log("===");

return (

  <div className="page2-page">
    <PageHead title="导入历史订单" description="xxxx。"/>
    <Tab defaultActiveKey="taobao-import" onChange={this.handleChange}>
      {
        tabs.map(item => <TabPane key={item.key} tab={item.tab}
                                  onClick={this.handleClick}></TabPane>)
      }
    </Tab>
    <DownLoadItem/>
    <div className="title">
      第二步: 上传历史订单
    </div>
    <div className="content">
      <FileUpload options={this.uploadOptions}>
        <p>You have uploaded {this.state.rate}</p>
        <Button ref="chooseAndUpload" type="primary">选中文件</Button>
      </FileUpload>

    </div>
  
  </div>
);

}
`
为什么当上传的时候,this.state.rate没有值?不会变化为什么?

uploading: function (progress) {
console.log(this)
let rate = progress.loaded / progress.total + '%';
this.setState({rate})
console.log('loading...', rate)
message.error(Upload failed,)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions