UNPKG

@aliretail/react-materials-components

Version:
72 lines (66 loc) 1.35 kB
--- title: Dashboard-Simple order: 1 --- 刷新reload ```jsx import React, { Component } from 'react'; import ReactDOM from 'react-dom'; import { Dashboard } from '@aliretail/react-materials-components'; import { Button } from '@alifd/next'; class App extends Component { constructor(props) { super(props); this.myref = React.createRef(); this.state = { apiParams: { name: '1111', }, }; } handleClick = () => { this.setState( { apiParams: { age: 888, }, }, () => { this.myref.current.reload(); } ); }; handleClick2 = () => { this.myref.current.reload({ age: 999, }); }; render() { return ( <div style={{ width: '900px' }}> <div> <Button type="primary" onClick={this.handleClick}> reload </Button> <Button style={{ marginLeft: '10px' }} type="primary" onClick={this.handleClick2} > reloadWithParams </Button> </div> <Dashboard appCode="retailforce_crm" apiCode="AssetAccountBalanceScoreStatistic" apiParams={this.state.apiParams} ref={this.myref} /> </div> ); } } ReactDOM.render(( <App /> ), mountNode); ```