mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(segment): fixed segment UI not updating when changing value from view button
Added a test for this. Closes #657
This commit is contained in:
@ -72,6 +72,9 @@ export class Segment extends Ion {
|
||||
*/
|
||||
writeValue(value) {
|
||||
this.value = !value ? '' : value;
|
||||
for (let button of this.buttons) {
|
||||
button.isActive = (button.value === value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,11 +112,9 @@ export class Segment extends Ion {
|
||||
if (this.buttons.length == 0) {
|
||||
return;
|
||||
}
|
||||
this.buttons.forEach(function(button) {
|
||||
if (button.value === value) {
|
||||
button.isActive = true;
|
||||
}
|
||||
});
|
||||
for (let button of this.buttons) {
|
||||
button.isActive = (button.value === value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user