Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对流星很陌生我正在向派对演示添加更新功能我现在只想向我尝试过的派对所有者显示“修改”按钮
{{# with party}} {{#if owner currentUser }} <br/><input type="button" value="Modifier" class="btn btn-small edit"> {{/if}
但是当然这不是正确的方法我找不到如何访问模板中的用户对象来比较它
请帮忙
您始终可以使用辅助方法中的this(本示例中的一个实例)访问 Template 对象实例:party
this
party
Template.details.isOwner = function() { return this.owner === Meteor.userId(); }; {{#if isOwner}} <br/><input type="button" value="Modifier" class="btn btn-small edit"> {{/if}}
canRemove(它与示例中已经存在的助手非常相似Parties。)
canRemove
Parties