簡體   English   中英

流星大火的renderwithdata通過自動格式化將文檔傳遞到模板

[英]meteor blaze renderwithdata pass document to template with autoform

我有以下模板:

<template name="editUser">
    {{> quickForm collection="Users" doc=doc id="editUserForm" type="update"}}
</template>

然后使用以下命令在popover div中進行渲染:

  Blaze.renderWithData(Template.editUser, data, target);

我想傳遞quickform所需的doc變量,但我不太了解data參數。

我嘗試將以下內容用作數據:

var data = {doc: Users.find({_id: feature.getId()}).fetch()};

但這似乎不是在變量doc中傳遞文檔的方法。

我找不到如何正確使用它,並希望避免會話變量。

我只是意識到我需要傳遞游標而不是數據本身。 所以當我替換時它起作用:

var data = {doc: Users.find({_id: feature.getId()}).fetch()};

var data = {doc: Users.find({_id: feature.getId()})};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM