我已经编写了这段代码来访问步骤菜单的每个步骤,并为char'check'更改其数字值。
我的问题是,是否有更好的方法。
valueChanged() {
this.value.emit(this.activeIndex);
var x = document.getElementsByClassName("ui-steps-number") as HTMLCollectionOf<HTMLElement>;
for (var _i = this.activeIndex-1; _i > -1; _i--) {
x[_i].innerHTML = "✔";
x[_i].style.backgroundColor = "#0081c2";
}
for (var _i = this.activeIndex+1; _i<this.items.length; _i++){
let str = (_i+1).toString()
x[_i].innerHTML = str;
x[_i].style.backgroundColor = "#FFFFFF";
}
x[this.activeIndex].innerHTML = (this.activeIndex+1).toString();
x[this.activeIndex].style.backgroundColor = "#0081c2";
}