import {
Component,
OnInit }
from
'@angular/core';
@
Component({
selector:
'indicator',
templateUrl:
'./indicator.component.html',
styleUrls: [
'./indicator.component.css']
})
export
class
IndicatorComponent
implements
OnInit {
public
imgUrl;
public
t;
public
i;
constructor() { }
ngOnInit() {
//图片集合
this.
t =
new
Array(
"../assets/images/bg.png",
"../assets/images/hls.jpg",
"../assets/images/zky.jpg");
this.
i =
0;
this.
changepic();
}
//循环方法
changepic() {
if (
this.
i >
2)
this.
i =
0;
this.
imgUrl =
this.
t[
this.
i];
this.
i++;
setTimeout(()
=> {
this.
changepic()
},
1000);
}
}