从著名的表面将数据从前端导入流星模板的推荐方法是什么? [英] What is a recommended way to get data into your meteor template from the front-end for a famous surface?

查看:116
本文介绍了从著名的表面将数据从前端导入流星模板的推荐方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直从 https://www.discovermeteor.com/并且我已经建立了一个名为显微镜"的教程项目

这使用铁路由器和流星模板系统渲染前端.我想在前端使用famo.us重做该项目,但是我不清楚如何执行此操作.

我知道一个叫做famono的软件包. mrt添加famono.使用此程序包,我可以集成famo.us并在流星项目中将表面绘制到屏幕上.它还允许您将模板呈现到屏幕上.

但是我对如何重做项目感到困惑,因为路由器-路由以数据渲染著名的表面.

我也想知道模板是否仍将是反应性的.

如果有人可以提供有关如何重做显微镜"项目以在前端使用famo.us的见解,我将不胜感激!

谢谢

更新(具体来说)

我一直在试图找出如何将著名的模板与路由集成在一起,但我不知道该怎么做.

我使用iron-router处理我的路由,该路由选择要呈现的模板和数据,如下所示:

Router.map ->
  @route 'posts',
    path: '/',
    data: ->
      Posts.findOne()

因此,这将使用Posts.findOne()数据加载帖子模板.

但是我知道我可以从前端的模板生成表面,就像这样:

background = new Surface
      template: Template.post
      data: ??? (Posts.findOne()) ???
mainContext.add(background) 

因为javascript是将最终模板加载到视图中的方法,对于我获取该模板数据的推荐方式是什么,我是否应该通过设置特殊订阅从前端查询数据库? /p>

通常我将数据从服务器上的路由器呈现到页面中,但是...

有了名牌,我只需要加载主模板,然后让名牌加载其余模板.剩下的唯一事情就是获取其他模板的数据.推荐什么?

解决方案

或者您可以看一下工作示例) https://github.com/sayawan?tab=repositories

I've been following along with the book Discover Meteor from https://www.discovermeteor.com/ and I have built the tutorial project called 'Microscope'

This uses iron-router and Meteor templating system to render out the front-end. I want to redo this project using famo.us for the front-end but I am unclear on how I to do so.

I am aware of a package called famono. mrt add famono. Using this package I can integrate famo.us and draw surface to the screen in a meteor project. It also allows you to render templates to the screen.

But I am confused on how to redo the project so the router - routes to render a famous surface with the data.

Also I am wondering if the templates will still be reactive.

If someone could provide insight on how to redo the 'Microscope' project to use famo.us on the front-end I would greatly appreciate it!

Thanks

UPDATE (to be more specific)

I have been trying to figure out how to integrate famous with templates and routing, and I have no clue how to do it.

I use iron-router to handle my routing which chooses which template and data to render like so:

Router.map ->
  @route 'posts',
    path: '/',
    data: ->
      Posts.findOne()

So this will load up the posts template with Posts.findOne() data.

But I know with famous I can generate surfaces from templates on the front end like so:

background = new Surface
      template: Template.post
      data: ??? (Posts.findOne()) ???
mainContext.add(background) 

Because javascript is what is going to load the final template into the view, what is the recommended way for me to get the data for that template, should I query the database from the front-end by setting up special subscriptions?

Typically I render the data into the page from the router on the server but...

with famous, I just have to load the main template and let famous load the rest of the templates. The only thing left is getting the data for the other templates. What is recommended?

解决方案

Or u can take a look at working examples ) https://github.com/sayawan?tab=repositories

这篇关于从著名的表面将数据从前端导入流星模板的推荐方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆