本文整理汇总了TypeScript中page.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: startRouters
export default function startRouters() {
detailRouter((ctx: Context) => {
logger.debug('Detail route');
const name = ctx.params.name;
getDetailByName(name).then(onDetailFromNetwork);
updateCurrentPage({ name: 'DETAIL_PAGE' });
});
homeRouter(ctx => {
logger.debug('Home route');
getList().then(onListFromNetwork);
updateCurrentPage({ name: 'HOME_PAGE' });
});
page();
}
示例2: init
const init = function init(store) {
page('/', function () {
store.dispatch({ type: 'SHOW_ALL' })
});
page('/show_all', function () {
store.dispatch({ type: 'SHOW_ALL' })
});
page('/show_active', function () {
store.dispatch({ type: 'SHOW_ACTIVE' })
});
page('/show_completed', function () {
store.dispatch({ type: 'SHOW_COMPLETED' })
});
page();
};
示例3: page
const module: ModuleDefinition = ({ app }) => {
app.on('initialized', () =>
page.start({
hashbang: true,
})
)
page.redirect('/', '/all')
page('/:filter', ({ path, params }) =>
app.runSequence(path, sequences.changeFilter, params)
)
return {
reactions,
state,
sequences,
providers,
}
}
示例4: homeRouter
function homeRouter(onRoute: OnRoute) {
page('', onRoute);
}
示例5: detailRouter
function detailRouter(onRoute: OnRoute) {
page('/detail/:name', onRoute);
}
示例6:
import page from 'page'
import init from './middleware/init'
import render from './middleware/render'
import index from './page/index'
import blog from './page/blog'
import notfound from './page/notfound'
page('*', init, render)
page('/', index)
page('/blog/:slug', blog)
page('*', notfound)
page()