【问题标题】:Meteor data context with collectionFS使用 collectionFS 的流星数据上下文
【发布时间】:2015-07-08 10:51:29
【问题描述】:

我想在我有“TITLE HERE”的collectionFS each 块中获取fave.title,有什么想法吗?

<template name="myFaves">
    <div class="container">
    <div class="page-header">
            <h2>Your Favourites</h2>
        </div>
        <div class="row">
            <div class="col-md-12">
                {{#each faves}}
                    {{> singleFave }}
                {{/each}}
            </div>
        </div>
    </div>
</template>

<template name="singleFave">
    <div class="row">
        <div class="col-md-12">
            <div id="freewall" class="freewall">
            {{#each getMedia this.fileId}}
                {{#if isImage store='thumb'}}
                    <div class="brick">
                        <img src="{{this.url store='thumb'}}" width="100%">
                        <div class="info">
                            TITLE HERE
                        </div>
                    </div>
                {{/if}}
            {{/each}}
            </div>
        </div>
    </div>
</template>

【问题讨论】:

  • 您需要更加明确。 fave.title 是您的 faves 集合文档的字段吗?
  • 这是一个在 {{> singleFave}} 模板中可用的字段,但是当我进入 getMedia 帮助器时,它变成了 collectionFS 实体,我想访问 singleFave 中可用的数据,但是更深一层。
  • 有效!我不知道你能做到这一点!谢谢。

标签: meteor collectionfs


【解决方案1】:

我猜你需要访问父上下文。试试{{../fave.title}}{{fave.title ..}}

请注意,也可以使用{{../.. fave.title}} 访问祖父母上下文

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-23
    • 2016-03-21
    • 2014-08-05
    • 2014-12-30
    • 2018-01-03
    • 2017-02-01
    • 2014-03-02
    相关资源
    最近更新 更多