Skip to content

Commit 027932f

Browse files
committed
cheng turn
1 parent 879839a commit 027932f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/App.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,19 @@ class App extends Component {
3333
point: 0,
3434
positionColor: 0
3535
},
36-
() => this.turnOn()
36+
() => this.turnOnSequence()
3737
);
3838
};
3939

40+
turnOnSequence = () => {
41+
let { listColors , positionColor } = this.state;
42+
console.log('sequence')
43+
for(var i = 0; i <= 5; i++ ){
44+
console.log(listColors[i])
45+
setTime(() => this.turnOn(listColors[i]));
46+
}
47+
}
48+
4049
turnOn = numColor => {
4150
let { positionColor, listColors } = this.state;
4251
let turnColor = listColors[positionColor];
@@ -68,7 +77,7 @@ class App extends Component {
6877
point: point + 1,
6978
positionColor: positionColor + 1
7079
},
71-
this.turnOn(listColors[positionColor + 1])
80+
() => this.turnOn()
7281
);
7382
} else {
7483
alert("It's wrong!!");

0 commit comments

Comments
 (0)