mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
29 lines
848 B
TypeScript
29 lines
848 B
TypeScript
import { View } from "tns-core-modules/ui/core/view";
|
|
import { ItemEventData } from "tns-core-modules/ui/list-view";
|
|
import { NavigatedData, Page } from "tns-core-modules/ui/page";
|
|
|
|
import { HomeViewModel } from "./home-view-model";
|
|
import { Item } from "./shared/item";
|
|
|
|
export function onNavigatingTo(args: NavigatedData) {
|
|
const page = <Page>args.object;
|
|
page.bindingContext = new HomeViewModel();
|
|
}
|
|
|
|
export function onItemTap(args: ItemEventData) {
|
|
const view = <View>args.view;
|
|
const page = <Page>view.page;
|
|
const tappedItem = <Item>view.bindingContext;
|
|
|
|
page.frame.navigate({
|
|
moduleName: "home/home-item-detail/home-item-detail-page",
|
|
context: tappedItem,
|
|
animated: true,
|
|
transition: {
|
|
name: "slide",
|
|
duration: 200,
|
|
curve: "ease"
|
|
}
|
|
});
|
|
}
|