路由在单页面应用开发中是一个相对比较重要的位置

以下为官方网站的路由配置

            <stencil-router scrollTopOffset={0}>
<stencil-route-switch>
<stencil-route url="/" component="landing-page" exact={true} />
<stencil-route
url="/docs/:pageName"
routeRender={(props: { [key: string]: any }) => {
const map = {
'introduction': 'introduction/why-stencil',
'goals-and-objectives': 'introduction/goals-and-objectives',
'browser-support': 'introduction/browser-support',
'getting-started': 'introduction/getting-started',
'my-first-component': 'introduction/my-first-component', 'component-lifecycle': 'components/component-lifecycle',
'decorators': 'components/decorators',
'events': 'components/events',
'reactive-data': 'components/reactive-data',
'templating-jsx': 'components/templating-and-jsx',
'styling': 'components/styling',
'forms': 'components/forms', 'framework-integration': 'framework-integration/overview',
'angular': 'framework-integration/angular',
'react': 'framework-integration/react',
'vue': 'framework-integration/vue',
'ember': 'framework-integration/ember',
'javascript': 'framework-integration/javascript', 'config': 'tooling/config',
'dev-server': 'tooling/dev-server',
'prerendering': 'tooling/prerendering',
'typed-components': 'tooling/typed-components',
'docs-auto-generation': 'tooling/docs-auto-generation',
'build-conditionals': 'tooling/build-conditionals',
'plugins': 'tooling/plugins', 'service-workers': 'guides/service-workers',
'distribution': 'guides/distribution',
'module-bundling': 'guides/module-bundling',
'router': 'guides/router',
'state-tunnel': 'guides/state-tunnel',
'redux': 'guides/redux',
'style-guide': 'guides/style-guide', 'testing': 'testing/overview',
'unit-testing': 'testing/unit-testing',
'e2e-testing': 'testing/e2e-testing',
'screenshot-visual-diff': 'testing/screenshot-visual-diff',
};
return (
<document-component
pages={[map[props.match.params.pageName]]}
/>
);
}}
/>
<stencil-route url="/demos" component="demos-page" />
<stencil-route url="/pwa" component="pwas-page" />
<stencil-route url="/resources" component="resources-page" /> <stencil-route component='notfound-page'></stencil-route>
</stencil-route-switch>
</stencil-router>

说明

这个路由的配置,将基本功能都用上了,比如routeRender 比较好的api 使用说明

参考资料

https://github.com/ionic-team/stencil-site

 
 
 
 

stenciljs 学习十二 官方doc 路由使用的例子的更多相关文章

  1. (转)SpringMVC学习(十二)——SpringMVC中的拦截器

    http://blog.csdn.net/yerenyuan_pku/article/details/72567761 SpringMVC的处理器拦截器类似于Servlet开发中的过滤器Filter, ...

  2. react第十二单元(react路由-使用react-router-dom-认识相关的组件以及组件属性)

    第十二单元(react路由-使用react-router-dom-认识相关的组件以及组件属性) #课程目标 理解路由的原理及应运 理解react-router-dom以及内置的一些组件 合理应用内置组 ...

  3. Scala学习十二——高阶函数

    一.本章要点 在Scala中函数是”头等公民“(可以作为参数,返回值,赋值给其他); 可以创建匿名函数,通常还会交给其他函数; 函数参数可以给出需要稍后执行的行为; 许多集合方法都接受函数参数,将函数 ...

  4. JVM学习十二:JVM之性能监控工具

    前面我们学习了很多JVM相关的理论知识,那么本节将重点讲述的是工具的使用,正所谓:工欲善其事,必先利其器.因此,本节介绍常用的性能监控工具,用于性能监控和问题排查. 一.系统性能监控 系统性能工具用于 ...

  5. MVC学习十四:MVC 路由 Route

    一.MVC路由(Route)是什么? MVC路由(Route)可以理解规定用户访问网站方式的配置文件,就例如:我们在访问普通页面时http://xxxx/web/xx.aspx,但在MVC中我们的访问 ...

  6. Java编程思想学习(十二) 数组和容器

    一.数组 1).数组的多种初始化方式 下面总结了初始化数组的多种方式,以及如何对指向数组的引用赋值,使其指向另一个数组对象.值得注意的是:对象数组和普通数组的各种操作基本上都是一样的:要说有什么不同的 ...

  7. java web 学习十二(session)

    一.Session简单介绍 在WEB开发中,服务器可以为每个用户浏览器创建一个会话对象(session对象),注意:一个浏览器独占一个session对象(默认情况下).因此,在需要保存用户数据时,服务 ...

  8. Flask 学习 十二 用户评论

    评论在数据库中的表示 由于评论和2个模型有关系,分别是谁发了评论,以及评论了哪个文章,所以这次要更新数据库模型 models.py 创建用户评论数据库模型 class Comment(db.Model ...

  9. 强化学习(十二) Dueling DQN

    在强化学习(十一) Prioritized Replay DQN中,我们讨论了对DQN的经验回放池按权重采样来优化DQN算法的方法,本文讨论另一种优化方法,Dueling DQN.本章内容主要参考了I ...

随机推荐

  1. Ubuntu 18.04 LTS 安装wine 、exe程序安装和卸载

    什么是wine?Wine(是“Wine Is Not an Emulator”的缩写)是一个兼容层,能够在几个POSIX兼容的操作系统上运行Windows应用程序,如Linux.MaOS.BSD.代替 ...

  2. python-day17--迭代器

    1.迭代: 迭代就是一个一个一个挨着的取值 2.可迭代类型:  str ,列表,元组,集合,字典 3.判断迭代器和可迭代的方法 #第一种:判断内部是不是实现了 __next__#'__next__' ...

  3. C++中的this指针

    1.关于this指针的一个精典回答: 当你进入一个房子后,你可以看见桌子.椅子.地板等,但是房子你是看不到全貌了.对于一个类的实例来说,你可以看到它的成员函数.成员变量,但是实例本身呢?this是一个 ...

  4. HDU-3506 Monkey Party (环形石子合并)

    题目大意:n堆石子围成一圈,每堆石子的块数已知,每次可以将相邻的两堆合并到一堆,块数变为两堆之和,代价也为两堆石子块数之和.求合并到一堆的最小代价. 题目分析:先通过将前n-1依次个移到第n个后面,将 ...

  5. 使用API失效供应商地址Demo(转)

    原文地址  使用API失效供应商地址Demo DECLARE lv_return_status ) := NULL; ln_msg_count NUMBER; lv_errmsg ); lt_vend ...

  6. OAF开发中一些LOV相关技巧 (转)

    原文地址:OAF开发中一些LOV相关技巧 在OAF开发中,LOV的使用频率是很高的,它由两部分构成一是页面上的LOV输入框(如OAMESSageLovInputBean),二是弹出的LOV模式窗口(O ...

  7. 对称点line

    2 线 题⽬描述 有一天rax看到了男神,有时可爱美丽的她派ypq去把yyqx抓回来给rax欣赏,但ypq和yyqx间隔了一条线,她必须跳到yyqx以前待得点的对称点才有可能抓到yyqx给出⼀条直线, ...

  8. System.out.println(i++); System.out.println(++i);的区别

    之前一直对i++和++i很模糊,这次通过两个小demo来探究下. 例1: public static void main(String[] args) { int i=2; System.out.pr ...

  9. TEdit的 Clear 和 赋值 ''

    function TControl.GetText: TCaption; var Len: Integer; begin Len := GetTextLen; SetString(Result, PC ...

  10. Double H6.0

    Double H 博客链接 成员 学号 姓名 211606379 王熙航(队长) 211606364 李冠锐 211606350 曾磊鑫 211606457 郑沐榕 211606342 杨艺勇 211 ...