mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
fix(segment-button): color property is now reactive if previously undefined (#22405)
resolves #20831
This commit is contained in:
@ -36,6 +36,22 @@ export class Segment implements ComponentInterface {
|
||||
* For more information on colors, see [theming](/docs/theming/basics).
|
||||
*/
|
||||
@Prop() color?: Color;
|
||||
@Watch('color')
|
||||
protected colorChanged(value?: Color, oldValue?: Color) {
|
||||
|
||||
/**
|
||||
* If color is set after not having
|
||||
* previously been set (or vice versa),
|
||||
* we need to emit style so the segment-buttons
|
||||
* can apply their color classes properly.
|
||||
*/
|
||||
if (
|
||||
(oldValue === undefined && value !== undefined) ||
|
||||
(oldValue !== undefined && value === undefined)
|
||||
) {
|
||||
this.emitStyle();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If `true`, the user cannot interact with the segment.
|
||||
|
Reference in New Issue
Block a user