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 ...
随机推荐
- Android Webview 和Javascript交互,实现Android和JavaScript相互调用
在Android的开发过程中.遇到一个新需求.那就是让Java代码和Javascript代码进行交互.在IOS中实现起来很麻烦.而在Android中相对来说容易多了.Android对这种交互进行了很好 ...
- 『PyTorch』第十弹_循环神经网络
RNN基础: 『cs231n』作业3问题1选讲_通过代码理解RNN&图像标注训练 TensorFlow RNN: 『TensotFlow』基础RNN网络分类问题 『TensotFlow』基础R ...
- python-day10--文件处理
1.文件:是操作系统提供的概念 2. open(r+'文件路径' , '打开方式' , '用什么字符编码') #r 表示原始字符串 eg:open(r'C:\Users\13264\Desktop ...
- thinkphp3.2 输入框默认值
1,我们在做项目的时候输入框有的时候要提示用户输入什么,当用户输入值的时候也不用客户删除,用户只管输入.这里我们就用一个很简单的就OK了. <input type="text" ...
- RAC配置(启停库)
关库顺序 :先关闭数据库 然后关闭节点资源 [root@rac1 ~]# srvctl stop database -d 数据库名[root@rac1 ~]# srvctl stop ins ...
- JavaWeb重定向和转发
if (user != null && passWord.equals(user.getPassWord())) { // 登录成功 // response.sendRedirect( ...
- ES profile 性能优化用——返回各个shard的耗时
Profile API 都说要致富先修路,要调优当然需要先监控啦,elasticsearch在很多层面都提供了stats方便你来监控调优,但是还不够,其实很多情况下查询速度慢很大一部分原因是糟糕的查询 ...
- 安装完DevExpress14.2.5,如何破解它呢?
DevExpress是一个界面控件套件,提供了一系列的界面控件套件的DotNet界面控件.DevExpress开发的控件有很强的实力,不仅功能丰富,应用简单,而且界面华丽,更可方便订制,方便开发人员开 ...
- PHP:第三章——PHP中函数的实参多余形参的处理方法
<?phpheader("Content-Type:text/html;charset=utf-8");//传参的函数/*function F($a){ echo $a ...
- learning uboot source command
reference: http://www.denx.de/wiki/DULG/UBootCmdGroupExec => help source source - run script from ...