ion-picker
Pickerは、画面下にボタンと列の行を表示するダイアログです。アプリケーションのコンテンツの上部とビューポートの下部に表示されます。
インラインピッカー(推奨)
ion-pickerは、テンプレートに直接コンポーネントを記述して使用することができます。これにより、ピッカーを表示するために必要なハンドラの数を減らすことができます。
ConsoleConsole messages will appear here when logged from the example above.isOpen を使う
ion-picker の isOpen プロパティにより、開発者はアプリケーションの状態からピッカーの表示状態を制御することができます。つまり、isOpen を true に設定するとピッカーが表示され、isOpen を false に設定するとピッカーは退場します。
isOpen は一方通行のデータバインディングを使用しているため、ピッカーが終了したときに自動的に false に設定されることはありません。開発者は ionPickerDidDismiss または didDismiss イベントを待ち、 isOpen を false に設定する必要があります。この理由は、ion-pickerの内部がアプリケーションの状態と密に結合するのを防ぐためです。一方通行のデータバインディングでは、ピッカーはリアクティブ変数が提供するブーリアン値のみに関心を持つ必要があります。一方通行のデータバインディングでは、ピッカーはリアクティブ変数のブール値だけでなく、リアクティブ変数の存在も気にする必要があります。このため、非決定的な動作が発生し、アプリケーションのデバッグが困難になる可能性があります。
ConsoleConsole messages will appear here when logged from the example above.Controller Pickers
pickerControllerは、ピッカーの表示・非表示をより細かく制御する必要がある場合に使用することができます。
ConsoleConsole messages will appear here when logged from the example above.マルチカラム
columnsプロパティは、異なる選択肢を複数の列で表示するピッカーを表示するために使用することができます。
ConsoleConsole messages will appear here when logged from the example above.Interfaces
PickerButton
interface PickerButton {
text?: string;
role?: string;
cssClass?: string | string[];
handler?: (value: any) => boolean | void;
}
PickerColumn
interface PickerColumn {
name: string;
align?: string;
/**
* Changing this value allows the initial value of a picker column to be set.
*/
selectedIndex?: number;
prevSelected?: number;
prefix?: string;
suffix?: string;
options: PickerColumnOption[];
cssClass?: string | string[];
columnWidth?: string;
prefixWidth?: string;
suffixWidth?: string;
optionsWidth?: string;
}
PickerColumnOption
interface PickerColumnOption {
text?: string;
value?: any;
disabled?: boolean;
duration?: number;
transform?: string;
selected?: boolean;
/**
* The optional text to assign as the aria-label on the picker column option.
*/
ariaLabel?: string;
}
PickerOptions
interface PickerOptions {
columns: PickerColumn[];
buttons?: PickerButton[];
cssClass?: string | string[];
showBackdrop?: boolean;
backdropDismiss?: boolean;
animated?: boolean;
mode?: Mode;
keyboardClose?: boolean;
id?: string;
htmlAttributes?: { [key: string]: any };
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
}
プロパティ
animated
| Description | If true, the picker will animate. |
| Attribute | animated |
| Type | boolean |
| Default | true |
backdropDismiss
| Description | If true, the picker will be dismissed when the backdrop is clicked. |
| Attribute | backdrop-dismiss |
| Type | boolean |
| Default | true |
buttons
| Description | Array of buttons to be displayed at the top of the picker. |
| Attribute | undefined |
| Type | PickerButton[] |
| Default | [] |
columns
| Description | Array of columns to be displayed in the picker. |
| Attribute | undefined |
| Type | PickerColumn[] |
| Default | [] |