当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript StateNavigator.onNavigate方法代码示例

本文整理汇总了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();
开发者ID:Kroisse,项目名称:DefinitelyTyped,代码行数:31,代码来源:navigation-tests.ts


注:本文中的navigation.StateNavigator.onNavigate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。