mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
refactor(all): enable strictPropertyInitialization
This commit is contained in:
@ -8,9 +8,10 @@ import { Component, Element, Event, EventEmitter, Prop } from '@stencil/core';
|
||||
}
|
||||
})
|
||||
export class SelectOption {
|
||||
id: string;
|
||||
|
||||
@Element() el: HTMLElement;
|
||||
private inputId = `ion-selopt-${selectOptionIds++}`;
|
||||
|
||||
@Element() el!: HTMLElement;
|
||||
|
||||
/**
|
||||
* If true, the user cannot interact with the select option. Defaults to `false`.
|
||||
@ -20,29 +21,25 @@ export class SelectOption {
|
||||
/**
|
||||
* If true, the element is selected.
|
||||
*/
|
||||
@Prop({ mutable: true }) selected = false;
|
||||
@Prop() selected = false;
|
||||
|
||||
/**
|
||||
* The text value of the option.
|
||||
*/
|
||||
@Prop({ mutable: true }) value: string;
|
||||
@Prop({ mutable: true }) value!: string;
|
||||
|
||||
/**
|
||||
* Emitted when the select option loads.
|
||||
*/
|
||||
@Event() ionSelectOptionDidLoad: EventEmitter;
|
||||
@Event() ionSelectOptionDidLoad!: EventEmitter;
|
||||
|
||||
/**
|
||||
* Emitted when the select option unloads.
|
||||
*/
|
||||
@Event() ionSelectOptionDidUnload: EventEmitter;
|
||||
|
||||
constructor() {
|
||||
this.id = 'ion-selopt-' + (selectOptionIds++);
|
||||
}
|
||||
@Event() ionSelectOptionDidUnload!: EventEmitter;
|
||||
|
||||
componentWillLoad() {
|
||||
if (this.value == null) {
|
||||
if (this.value === undefined) {
|
||||
this.value = this.el.textContent || '';
|
||||
}
|
||||
}
|
||||
@ -58,7 +55,7 @@ export class SelectOption {
|
||||
hostData() {
|
||||
return {
|
||||
'role': 'option',
|
||||
'id': this.id
|
||||
'id': this.inputId
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user