mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
refactor(all): strict boolean conditions
This commit is contained in:
@ -10,12 +10,12 @@ Their functionality is similar to tabs, where selecting one will deselect all ot
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Attribute | Description | Type |
|
||||
| ---------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
|
||||
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
|
||||
| `disabled` | `disabled` | | `boolean` |
|
||||
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
|
||||
| `value` | `value` | the value of the segment. | `string` |
|
||||
| Property | Attribute | Description | Type |
|
||||
| ---------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
||||
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
|
||||
| `disabled` | `disabled` | | `boolean` |
|
||||
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
|
||||
| `value` | `value` | the value of the segment. | `string`, `null` |
|
||||
|
||||
|
||||
## Events
|
||||
|
@ -36,7 +36,7 @@ export class Segment {
|
||||
/**
|
||||
* the value of the segment.
|
||||
*/
|
||||
@Prop({ mutable: true }) value?: string;
|
||||
@Prop({ mutable: true }) value?: string | null;
|
||||
|
||||
@Watch('value')
|
||||
protected valueChanged(value: string | undefined) {
|
||||
@ -56,7 +56,7 @@ export class Segment {
|
||||
}
|
||||
|
||||
componentDidLoad() {
|
||||
if (this.value === undefined) {
|
||||
if (this.value == null) {
|
||||
const checked = this.getButtons().find(b => b.checked);
|
||||
if (checked) {
|
||||
this.value = checked.value;
|
||||
|
Reference in New Issue
Block a user