stenciljs 学习十二 官方doc 路由使用的例子
路由在单页面应用开发中是一个相对比较重要的位置
以下为官方网站的路由配置
<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 路由使用的例子的更多相关文章
- (转)SpringMVC学习(十二)——SpringMVC中的拦截器
http://blog.csdn.net/yerenyuan_pku/article/details/72567761 SpringMVC的处理器拦截器类似于Servlet开发中的过滤器Filter, ...
- react第十二单元(react路由-使用react-router-dom-认识相关的组件以及组件属性)
第十二单元(react路由-使用react-router-dom-认识相关的组件以及组件属性) #课程目标 理解路由的原理及应运 理解react-router-dom以及内置的一些组件 合理应用内置组 ...
- Scala学习十二——高阶函数
一.本章要点 在Scala中函数是”头等公民“(可以作为参数,返回值,赋值给其他); 可以创建匿名函数,通常还会交给其他函数; 函数参数可以给出需要稍后执行的行为; 许多集合方法都接受函数参数,将函数 ...
- JVM学习十二:JVM之性能监控工具
前面我们学习了很多JVM相关的理论知识,那么本节将重点讲述的是工具的使用,正所谓:工欲善其事,必先利其器.因此,本节介绍常用的性能监控工具,用于性能监控和问题排查. 一.系统性能监控 系统性能工具用于 ...
- MVC学习十四:MVC 路由 Route
一.MVC路由(Route)是什么? MVC路由(Route)可以理解规定用户访问网站方式的配置文件,就例如:我们在访问普通页面时http://xxxx/web/xx.aspx,但在MVC中我们的访问 ...
- Java编程思想学习(十二) 数组和容器
一.数组 1).数组的多种初始化方式 下面总结了初始化数组的多种方式,以及如何对指向数组的引用赋值,使其指向另一个数组对象.值得注意的是:对象数组和普通数组的各种操作基本上都是一样的:要说有什么不同的 ...
- java web 学习十二(session)
一.Session简单介绍 在WEB开发中,服务器可以为每个用户浏览器创建一个会话对象(session对象),注意:一个浏览器独占一个session对象(默认情况下).因此,在需要保存用户数据时,服务 ...
- Flask 学习 十二 用户评论
评论在数据库中的表示 由于评论和2个模型有关系,分别是谁发了评论,以及评论了哪个文章,所以这次要更新数据库模型 models.py 创建用户评论数据库模型 class Comment(db.Model ...
- 强化学习(十二) Dueling DQN
在强化学习(十一) Prioritized Replay DQN中,我们讨论了对DQN的经验回放池按权重采样来优化DQN算法的方法,本文讨论另一种优化方法,Dueling DQN.本章内容主要参考了I ...
随机推荐
- axios构建缓存池存储基础数据
项目中经常出现需要多次使用的后端数据,通常的做法是通过变量缓存数据,或者通过类似vuex的东西来进行缓存,但是麻烦在于很可能需要判断一大堆的条件,或者说如果有权限控制的时候数据能否读取也是很麻烦的事情 ...
- 『Sklearn』数据划分方法
原理介绍 K折交叉验证: KFold,GroupKFold,StratifiedKFold, 留一法: LeaveOneGroupOut,LeavePGroupsOut,LeaveOneOut,Lea ...
- 弗洛伊德算法(Floyd算法)
原博来自http://www.cnblogs.com/skywang12345/ 弗洛伊德算法介绍 和Dijkstra算法一样,弗洛伊德(Floyd)算法也是一种用于寻找给定的加权图中顶点间最短路径的 ...
- UVA-1533 Moving Pegs (路径寻找问题)
Description Venture MFG Company, Inc. has made a game board. This game board has 15 holes and thes ...
- 追加XML
追加有两种情况,这个文档可能存在,也可能不存在 XmlDocument doc = new XmlDocument();XmlElement books; //将books声明在外边这样后面的代码才可 ...
- Pandas DataFrame 数据选取和过滤
This would allow chaining operations like: pd.read_csv('imdb.txt') .sort(columns='year') .filter(lam ...
- 清除mac出现的.DS_Store文件
一.什么是.DS_Store文件 在 Mac OS X 系统下,大部分文件夹中都包含 .DS_Store 隐藏文件,这里保存着针对这个目录的特殊信息和设置配置,例如查看方式.图标大小以及这个目录的一些 ...
- Linux rm的一次误用
今天在Linux下误用了一次rm -rf,经历惨痛,记录一下. 原因是我删除了一个文件到回收站,然后点错了将home下的所有东西都删到了回收站,然后我又从回收站拷贝回home目录而不是使用恢复,因为h ...
- 安装 Java 6
从服务器下载 Linux 64位 jdk 到本地.下载地址:\\192.167.100.225\share\Tool\JAVA\jdk-6u34-linux-x64.bin 给安装文件添加执行权限 $ ...
- CentOS 6.6安装postgresql9.6.6
一.环境介绍 系统平台:CentOS release 6.6 (Final) Postgresql:postgresql-9.6.6 二.安装过程 1.安装依赖包 yum -y install gcc ...