本文整理汇总了TypeScript中bobril.routes函数的典型用法代码示例。如果您正苦于以下问题:TypeScript routes函数的具体用法?TypeScript routes怎么用?TypeScript routes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了routes函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import * as b from 'bobril';
import { mainPage } from './mainPage';
b.routes(
b.route({ handler: mainPage })
);
示例2:
import * as s from './src/states';
import * as c from './src/states.cursors';
import * as wnp from './src/whatNext/page';
b.asset('css/bootstrap.css');
f.bootstrap(s.createDefaultApplicationState(), (message, params) => { });
b.routes(
b.route(
{
url: '/',
handler: mp.create
},
[
b.route({
url: '/todos',
name: 'todos',
handler: tdp.create(c.todosCursor)
}),
b.route({
url: '/whatNext',
name: 'whatNext',
handler: wnp.create(c.whatNextCursor)
}),
b.routeDefault({
name: 'default',
handler: tdp.create(c.todosCursor)
})
])
);
示例3: Button
b.routes(b.route({
handler: (data) => {
let h = data.activeRouteHandler;
return [
h ? h() : null,
b.styledDiv(gLog.map(s => b.styledDiv(s)))
]
}
}, [
b.route({
name: "a", handler: () => {
return Button({
action: () => {
b.runTransition(b.createRedirectPush("b"));
}
}, "A")
}
}),
b.route({
name: "b", handler: () => {
return Button({
action: () => {
b.runTransition(b.createRedirectPush("a"));
}
}, "B")
}
}),
b.routeDefault({
handler: {
canActivate(transition: b.IRouteTransition): b.IRouteCanResult {
return b.createRedirectReplace("a");
}
}
})
]
));
示例4:
import * as b from 'bobril';
import * as router from './pages/router';
import app from './pages/app';
import home from './pages/home/page';
import documentation from './pages/documentation/page';
import * as m from 'bobril-m';
b.injectCss('html,body{margin:0; padding:0; height:100%}');
m.initRobotoFonts();
b.routes(
b.route({handler: app}, [
b.route({url: `/${router.home}`, name: router.home, handler: home}),
b.route({url: `/${router.documentation}`, name: router.documentation, handler: documentation}),
b.routeDefault({handler: home})
])
);