Commit ad38d93f authored by ้™ˆๅธ…'s avatar ้™ˆๅธ…

Optimization: use state to control rendering time

parent f3b77d43
......@@ -34,3 +34,5 @@ functions/mock
.umi
.umi-production
# screenshot
screenshot
\ No newline at end of file
......@@ -61,6 +61,7 @@ class Analysis extends Component {
this.state = {
salesType: 'all',
currentTabKey: '',
loading: true,
rangePickerValue: getTimeDistance('year'),
};
}
......@@ -77,6 +78,11 @@ class Analysis extends Component {
dispatch({
type: 'chart/fetch',
});
setTimeout(() => {
this.setState({
loading: false,
});
}, 1000);
});
}
......@@ -137,8 +143,8 @@ class Analysis extends Component {
}
render() {
const { rangePickerValue, salesType, currentTabKey } = this.state;
const { chart, loading } = this.props;
const { rangePickerValue, salesType, loading: propsLoding, currentTabKey } = this.state;
const { chart, loading: stateLoading } = this.props;
const {
visitData,
visitData2,
......@@ -150,7 +156,7 @@ class Analysis extends Component {
salesTypeDataOnline,
salesTypeDataOffline,
} = chart;
const loading = propsLoding || stateLoading;
const salesPieData =
salesType === 'all'
? salesTypeData
......
......@@ -31,9 +31,7 @@ function formatter(data, parentPath = '', parentAuthority, parentName) {
return result;
});
}
/**
* ๆ นๆฎ่œๅ•ๅ–ๅพ—้‡ๅฎšๅ‘ๅœฐๅ€.
*/
// get meun map data
const MenuData = formatter(routerConfig[1].routes);
class LoadingPage extends PureComponent {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment