Commit 55c50d96 authored by haiyoucuv's avatar haiyoucuv

init

parent bfaef8d4
...@@ -15,6 +15,8 @@ class ReviewPanel extends React.Component { ...@@ -15,6 +15,8 @@ class ReviewPanel extends React.Component {
animationCompleted: false animationCompleted: false
}; };
t = 0;
componentDidMount() { componentDidMount() {
// 延迟启动动画 // 延迟启动动画
setTimeout(() => { setTimeout(() => {
...@@ -22,6 +24,10 @@ class ReviewPanel extends React.Component { ...@@ -22,6 +24,10 @@ class ReviewPanel extends React.Component {
}, 200); }, 200);
} }
componentWillUnmount() {
clearTimeout(this.t);
}
startAnimation = () => { startAnimation = () => {
// 逐个显示 item // 逐个显示 item
this.state.itemsVisible.forEach((_, index) => { this.state.itemsVisible.forEach((_, index) => {
...@@ -36,6 +42,9 @@ class ReviewPanel extends React.Component { ...@@ -36,6 +42,9 @@ class ReviewPanel extends React.Component {
if (index === this.state.itemsVisible.length - 1) { if (index === this.state.itemsVisible.length - 1) {
setTimeout(() => { setTimeout(() => {
this.setState({ animationCompleted: true }); this.setState({ animationCompleted: true });
this.t = setTimeout(()=>{
this.clickNext();
});
}, 600); // 等待最后一个 item 的动画完成 (0.6s) }, 600); // 等待最后一个 item 的动画完成 (0.6s)
} }
}, index * 300); // 每个 item 延迟 300ms }, index * 300); // 每个 item 延迟 300ms
......
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