meteor:打开对话框后设置字段
我正在努力完成派对演示 具有“编辑聚会”功能 我知道创建对话框在设置会话showCreateDialog时打开meteor:打开对话框后设置字段,meteor,sample,Meteor,Sample,我正在努力完成派对演示 具有“编辑聚会”功能 我知道创建对话框在设置会话showCreateDialog时打开 {{#if showCreateDialog}} {{> createDialog}} {{/if}} 这显示了popin 但我想设置为字段后打开 我看不出在打开操作后如何操作?您可以在模板的内部设置操作DOM。但是如果你发现自己在这里写了很多粘合代码($(“#someInput”).val(“someVal”)),那么要小心,因为你可能走错了方向 Template
{{#if showCreateDialog}}
{{> createDialog}}
{{/if}}
这显示了popin
但我想设置为字段后打开
我看不出在打开操作后如何操作?您可以在模板的内部设置操作DOM。但是如果你发现自己在这里写了很多粘合代码(
$(“#someInput”).val(“someVal”)
),那么要小心,因为你可能走错了方向
Template.createDialog.rendered = function() {
// you can manipulate the DOM here
}
请记住,您可以将字段值绑定到实例,因此下面类似的内容将自动绑定您的对象
<template name="editDialog">
{{#with party}}
<input type="text" id="myPartyName" value="{{name}}" />
...
{{/with}}
</template>
Template.editDialog.party = function() {
return Parties.findOne(Session.get("selectedParty"));
};
{{{与政党}
...
{{/与}}
Template.editDialog.party=函数(){
返回Parties.findOne(Session.get(“selectedParty”);
};