mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { EventData, fromObject } from "tns-core-modules/data/observable";
|
|
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
|
|
import { Page } from "tns-core-modules/ui/page";
|
|
|
|
export function onNavigatingTo(args: EventData) {
|
|
const page = <Page>args.object;
|
|
const vm = fromObject({
|
|
// Setting the listview binding source
|
|
myTitles: [
|
|
{ title: "The Da Vinci Code" },
|
|
{ title: "Harry Potter and the Chamber of Secrets" },
|
|
{ title: "The Alchemist" },
|
|
{ title: "The Godfather" },
|
|
{ title: "Goodnight Moon" },
|
|
{ title: "The Hobbit" },
|
|
{ title: "The Da Vinci Code" },
|
|
{ title: "Harry Potter and the Chamber of Secrets" },
|
|
{ title: "The Alchemist" },
|
|
{ title: "The Godfather" },
|
|
{ title: "Goodnight Moon" },
|
|
{ title: "The Hobbit" },
|
|
{ title: "The Da Vinci Code" },
|
|
{ title: "Harry Potter and the Chamber of Secrets" },
|
|
{ title: "The Alchemist" },
|
|
{ title: "The Godfather" },
|
|
{ title: "Goodnight Moon" },
|
|
{ title: "The Hobbit" },
|
|
{ title: "The Da Vinci Code" },
|
|
{ title: "Harry Potter and the Chamber of Secrets" },
|
|
{ title: "The Alchemist" },
|
|
{ title: "The Godfather" },
|
|
{ title: "Goodnight Moon" },
|
|
{ title: "The Hobbit" },
|
|
]
|
|
});
|
|
page.bindingContext = vm;
|
|
}
|
|
|
|
export function onListViewLoaded(args: EventData) {
|
|
const listView = <ListView>args.object;
|
|
}
|
|
|
|
export function onItemTap(args: ItemEventData) {
|
|
const index = args.index;
|
|
console.log(`Second ListView item tap ${index}`);
|
|
}
|