gpt4 book ai didi

meteor - if is not equal in blaze 怎么写

转载 作者:行者123 更新时间:2023-12-02 17:20:10 25 4
gpt4 key购买 nike

我在 js 文件中有这个:

  isAdmin: function() {
if (Meteor.user().roles[0] == "admin") {
return true;
} else {
return false;
}
},

在Html中我想说if admin ==false.怎么回事?

条件为真:我要假

  {{#if isAdmin}}
...
{{/if}}

这样可以吗?

  {{#if !isAdmin}}
...
{{/if}}

最佳答案

我猜你在找什么

{{#unless isAdmin}}
...
{{/unless}}

看看here在文档中。

顺便说一句,如果您使用的是 alanning:roles 包,它包含一个方便的 Blaze 小 helper 。

{{#unless isInRole 'admin'}}
...
{{/unless}}

希望对您有所帮助。

关于meteor - if is not equal in blaze 怎么写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43410427/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com