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 ...
随机推荐
- php数组转化为字符串
1.函数explode(); 这个是字符串转化为数组 , implode() ;这个是数组转化为字符串. $array=explode(separator,$string); $string=imp ...
- http 中的 Get 与 Post
GET 和 POST 是 HTTP 请求的两种基本方法 —— Http 定义了(客户端.浏览器)与服务器交互的不同方法,最基本的方法有4种, 分别是GET,POST,PUT,DELETE.(HTTP协 ...
- json格式化
jar包:gson-xxx.jar import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.goog ...
- javascript里的偏函数——本质函数式编程+闭包,返回函数
最终效果: var greet = function(greeting, name) { return greeting + ' ' + name; }; var sayHelloTo = _.par ...
- 6.pragma pack
下面两个结构体 struct One { double d; char c; int i; } struct Two { char c; double d; int i; } 在#pragma pac ...
- ssh的配置,ssh打开密钥登陆,关闭密码登陆。
刚装玩fedora,那么我们就以fedora为例来说一下怎么配置: 1.先确认是否已安装ssh服务: [root@localhost ~]# rpm -qa | grep openssh-server ...
- Struts2的手工自定义验证--完整实例代码
ActionSupport类实现了Validateable.ValidationAware接口, 其中Validateable接口就是验证器接口,该接口有一个validate()方法, validat ...
- git在idea中的使用,如何构远程git方仓库
git 下载:http://learning.happymmall.com/git/ 配置用户名:$ git config --glob user.name "forever" ...
- 扫描系统句柄表(WIN7 x86)(附录源码)
PspCidTable存放着系统中所有的进程和线程对象,其索引也就是进程ID(PID)或线程ID(TID).先通过它来看看windbg里的HANDLE_TABLE结构: 可以看到地址 0x83f41b ...
- L1-014 简单题
这次真的没骗你 —— 这道超级简单的题目没有任何输入. 你只需要在一行中输出事实:This is a simple problem. 就可以了. 输入样例: 无 输出样例: This is a sim ...