mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Fix(segment): Change for loops to be forEach
This commit is contained in:
@ -80,13 +80,11 @@ export class Segment extends Ion {
|
|||||||
if (this.buttons.length == 0) {
|
if (this.buttons.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//for(let button of this.buttons) {
|
this.buttons.forEach(function(button) {
|
||||||
for(var i = 0, j = this.buttons.length; i < j; i++) {
|
|
||||||
var button = this.buttons[i];
|
|
||||||
if(button.value === value) {
|
if(button.value === value) {
|
||||||
button.isActive = true;
|
button.isActive = true;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,11 +92,9 @@ export class Segment extends Ion {
|
|||||||
* @param {SegmentButton} segmentButton The button to select.
|
* @param {SegmentButton} segmentButton The button to select.
|
||||||
*/
|
*/
|
||||||
selected(segmentButton) {
|
selected(segmentButton) {
|
||||||
//for(let button of this.buttons) {
|
this.buttons.forEach(function(button) {
|
||||||
for(var i = 0, j = this.buttons.length; i < j; i++) {
|
|
||||||
let button = this.buttons[i];
|
|
||||||
button.isActive = false;
|
button.isActive = false;
|
||||||
}
|
});
|
||||||
segmentButton.isActive = true;
|
segmentButton.isActive = true;
|
||||||
|
|
||||||
//this.onChange();
|
//this.onChange();
|
||||||
|
Reference in New Issue
Block a user