本文整理汇总了TypeScript中navigation.StateNavigator.onNavigate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript StateNavigator.onNavigate方法的具体用法?TypeScript StateNavigator.onNavigate怎么用?TypeScript StateNavigator.onNavigate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation.StateNavigator
的用法示例。
在下文中一共展示了StateNavigator.onNavigate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: urlEncode
};
person.navigated = (data) => {};
person.urlEncode = function urlEncode(state: State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\s/g, '+') : encodeURIComponent(val);
};
person.urlDecode = function urlDecode(state: State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\+/g, ' ') : decodeURIComponent(val);
};
person.validate = (data: any) => data.id > 0;
person.truncateCrumbTrail = (state: State, data: any, crumbs: Crumb[]) => crumbs;
// Navigation Event
var navigationListener = (oldState: State, state: State, data: any, asyncData: any) => {
stateNavigator.offNavigate(navigationListener);
};
stateNavigator.onNavigate(navigationListener);
// Navigation
stateNavigator.navigate('people');
stateNavigator.navigate('people', null, 'add');
stateNavigator.refresh();
stateNavigator.refresh({ page: 3 });
stateNavigator.refresh({ page: 2 }, 'replace');
stateNavigator.navigate('person', { id: 10 });
var canGoBack: boolean = stateNavigator.canNavigateBack(1);
stateNavigator.navigateBack(1);
stateNavigator.stateContext.clear();
// Navigation Link
var link = stateNavigator.getNavigationLink('people');
link = stateNavigator.getRefreshLink();