mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
refactor: set selectedIndex = 3 of list-picker (#5008)
* refactor: set selectedIndex = 3 of list-picker * refactor: list-picker.ts * refactor: list-picker.xml * fix: remove ios import
This commit is contained in:
@ -1,7 +1,13 @@
|
||||
import { ListPicker } from "tns-core-modules/ui/list-picker";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export function loaded(args) {
|
||||
var items = [];
|
||||
const items = [];
|
||||
for (var i = 0; i < 100; i++) {
|
||||
items.push("name" + i);
|
||||
}
|
||||
args.object.bindingContext = { items: items };
|
||||
|
||||
const target = (<Page>args.object.page).getViewById<ListPicker>("target");
|
||||
target.items = items;
|
||||
target.selectedIndex = 3;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page loaded="loaded">
|
||||
<StackLayout>
|
||||
<ListPicker items="{{ items }}" style="color: deeppink; background-color:lightskyblue" />
|
||||
<ListPicker id="target" items="{{ items }}" style="color: deeppink; background-color:lightskyblue" />
|
||||
</StackLayout>
|
||||
</Page>
|
||||
|
Reference in New Issue
Block a user