mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
refactor(): remove checked property in favor of parent value (#19449)
BREAKING CHANGE: The following components have been updated to remove the checked or selected properties: - Radio - Segment Button - Select Developers should set the value property on the respective parent components in order to managed checked/selected status. Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
@ -26,7 +26,7 @@ export class SelectPopover implements ComponentInterface {
|
||||
/** Array of options for the popover */
|
||||
@Prop() options: SelectPopoverOption[] = [];
|
||||
|
||||
@Listen('ionSelect')
|
||||
@Listen('ionChange')
|
||||
onSelect(ev: any) {
|
||||
const option = this.options.find(o => o.value === ev.target.value);
|
||||
if (option) {
|
||||
@ -35,6 +35,8 @@ export class SelectPopover implements ComponentInterface {
|
||||
}
|
||||
|
||||
render() {
|
||||
const checkedOption = this.options.find(o => o.checked);
|
||||
const checkedValue = checkedOption ? checkedOption.value : undefined;
|
||||
return (
|
||||
<Host class={getIonMode(this)}>
|
||||
<ion-list>
|
||||
@ -47,14 +49,13 @@ export class SelectPopover implements ComponentInterface {
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
}
|
||||
<ion-radio-group>
|
||||
<ion-radio-group value={checkedValue}>
|
||||
{this.options.map(option =>
|
||||
<ion-item>
|
||||
<ion-label>
|
||||
{option.text}
|
||||
</ion-label>
|
||||
<ion-radio
|
||||
checked={option.checked}
|
||||
value={option.value}
|
||||
disabled={option.disabled}
|
||||
>
|
||||
|
Reference in New Issue
Block a user