简体   繁体   English

使用Meteor / React的多页面应用程序

[英]Multi-page Applications with Meteor/React

I am new to Meteor/React and am trying to figure out how to create a multi-page application. 我是Meteor / React的新手,正在试图弄清楚如何创建一个多页应用程序。 I'm getting really confused about how to actually get routing to work. 我真的很困惑如何让路由工作。 I want to have multiple html files that, depending on what happens on one, will cause another one to be rendered. 我希望有多个html文件,取决于在一个上发生的事情,将导致另一个html文件被渲染。 For example, 例如,

I'm on main.html and I click a button -> and it should then cause secondary.html to render on the screen. 我在main.html上,然后单击一个按钮 - >然后它应该导致secondary.html在屏幕上呈现。 I hit another button on secondary.html -> and it directs me to tertiary.html. 我点击了secondary.html上的另一个按钮 - >它指示我访问tertiary.html。

However, whenever I launch an application, all my html files just get rendered all at once (something that Meteor just does automatically I guess). 但是,每当我启动一个应用程序时,我的所有html文件都会立即被渲染(Meteor就是自动生成的东西)。 I've been trying to work with FlowRouter. 我一直在尝试使用FlowRouter。 Any help or advice would be greatly appreciated!! 任何帮助或建议将不胜感激!

I'm getting confortable with iron:router package, you can see the documentation here : https://atmospherejs.com/iron/router 我很满意铁:路由器包,你可以在这里看到文档: https//atmospherejs.com/iron/router

Have a look on what options you can add to this by visiting the documentation... 通过访问文档,了解您可以添加哪些选项...

But still, this is how you implement it the easiest way : 但是,这仍然是您以最简单的方式实现它的方式:

Router.route("/myCustomRoute",function(){
this.render("/myCustomTemplate")
}

By doing this, you will allow your application to have multiples routes :) However, FlowRouter is a very good option (maybe better) but it will be the same "logic of code" behind :) 通过这样做,你将允许你的应用程序有多个路由:)但是,FlowRouter是一个非常好的选择(可能更好)但它将是相同的“代码逻辑”背后:)

Hope it will help ! 希望它会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM