meteor中多页面的处理
来源:互联网 发布:win10软件显示不全 编辑:程序博客网 时间:2024/06/16 06:36
1.使用 iron-router,创建一个布局模板,然后将其他模板使用{{> yield}}注入到其中。(可以通过查看iron-router的文档了解布局模板)。(可以在atmosphere中查找相关内容)
2.使用{{> Template.dynamic}}。
eg:
<body>
<ul>
<li><a href="#" class="index">Home</li>
<li><a href="#" class="about">About
<li><a href="#" class="contact">Contact
</ul>
{{> Template.dynamic template=template_name }}
</body>
其中template_name可以使用template helper来改变<ul>
<li><a href="#" class="index">Home</li>
<li><a href="#" class="about">About
</li>
<li><a href="#" class="contact">Contact
</li>
</ul>
{{> Template.dynamic template=template_name }}
</body>
Meteor.startup(function () {
Session.setDefault("templateName", "index")
});
Template.body.helpers({
template_name: function(){
return Session.get("templateName")
}
});
Template.body.events({
"click .home": function() {
Session.set("templateName", "index");
},
"click .about": function() {
Session.set("templateName", "about");
}
// ..
});
如果session返回的是"about",{{> Template.dynamic template="about"}} 就相当于{{> about}}.
1 0
- meteor中多页面的处理
- meteor中异步回调的处理的方法
- Meteor 中 Methods 的简单用法
- Meteor 项目服务器端页面渲染
- 在Meteor中调用NodeJS模块或者自己的模块
- [Meteor]优秀的Meteor学习资源
- 处理过程中页面遮挡的技术
- 项目中处理异常的错误页面
- JSP中页面框架的处理
- Meteor with的使用
- 未来的框架Meteor
- Meteor 的 Android 支持
- Meteor常用的命令
- Meteor常用的命令
- Meteor 修改查询条件页面首次显示的时候刷新问题
- meteor
- meteor
- Meteor
- IIC等待应答
- 线程池&任务
- 如何用Android MTK源码生成签名文件(debug.keystore)
- java中文编码(字符集)分析-中文乱码分析及解决方案
- 服务器SSL不安全漏洞修复方案
- meteor中多页面的处理
- LoadRunner 的参数化数据更新方式解析
- Android Vold 架构简析
- worldwind java中Mercator层的图片不清晰问题
- 支付宝遇到的各种坑
- solr6.0配置中文分词器IK Analyzer
- python库matplotlib如何通过xshell生成图形界面
- 自己摸索的一些使用中的html查找替换正则
- qt实现缩略图