Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
e1290d8e
Commit
e1290d8e
authored
Feb 18, 2019
by
Shuai Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: use requestAnimationFrame
parent
9da468f4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
17 deletions
+16
-17
src/components/ActiveChart/index.js
src/components/ActiveChart/index.js
+10
-12
src/components/Charts/AsyncLoadBizCharts.js
src/components/Charts/AsyncLoadBizCharts.js
+4
-2
src/components/Charts/index.js
src/components/Charts/index.js
+2
-2
src/pages/Dashboard/Analysis.js
src/pages/Dashboard/Analysis.js
+0
-1
No files found.
src/components/ActiveChart/index.js
View file @
e1290d8e
...
...
@@ -33,7 +33,6 @@ export default class ActiveChart extends Component {
}
loopData
=
()
=>
{
this
.
requestRef
=
requestAnimationFrame
(()
=>
{
this
.
timer
=
setTimeout
(()
=>
{
this
.
setState
(
{
...
...
@@ -43,8 +42,7 @@ export default class ActiveChart extends Component {
this
.
loopData
();
}
);
},
1000
);
});
},
500
);
};
render
()
{
...
...
src/components/Charts/AsyncLoadBizCharts.js
View file @
e1290d8e
...
...
@@ -24,9 +24,11 @@ class AsyncLoadBizCharts extends React.Component {
async
componentDidMount
()
{
await
loadBizCharts
();
requestAnimationFrame
(()
=>
{
this
.
setState
({
loading
:
false
,
});
});
}
render
()
{
...
...
src/components/Charts/index.js
View file @
e1290d8e
import
React
,
{
Suspense
}
from
'
react
'
;
import
numeral
from
'
numeral
'
;
import
ChartCard
from
'
./ChartCard
'
;
import
Field
from
'
./Field
'
;
const
getComponent
=
Component
=>
{
return
props
=>
{
return
(
<
Suspense
fallback
=
{
null
}
>
<
Suspense
fallback
=
"
...
"
>
<
Component
{...
props
}
/
>
<
/Suspense
>
);
...
...
@@ -19,7 +20,6 @@ const Gauge = getComponent(React.lazy(() => import('./Gauge')));
const
MiniArea
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./MiniArea
'
)));
const
MiniBar
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./MiniBar
'
)));
const
MiniProgress
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./MiniProgress
'
)));
const
Field
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./Field
'
)));
const
WaterWave
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./WaterWave
'
)));
const
TagCloud
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./TagCloud
'
)));
const
TimelineChart
=
getComponent
(
React
.
lazy
(()
=>
import
(
'
./TimelineChart
'
)));
...
...
src/pages/Dashboard/Analysis.js
View file @
e1290d8e
...
...
@@ -25,7 +25,6 @@ class Analysis extends Component {
};
componentDidMount
()
{
console
.
log
(
'
run
'
);
const
{
dispatch
}
=
this
.
props
;
this
.
reqRef
=
requestAnimationFrame
(()
=>
{
dispatch
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment