gpt4 book ai didi

javascript - 如何不做 helper ?

转载 作者:行者123 更新时间:2023-11-29 16:08:38 24 4
gpt4 key购买 nike

执行 NOT 操作的最佳方法是什么?

例如,这里是javascript

Template.mytemplate.helper({
myhelper : function(){
return true;
}
});

现在如何在模板中获取 !myhelper?我一直在做

<template name="mytemplate">
{{#if myhelper}}
{{else}}
myhelper is false
{{/if}}
</template>

但一定有更好的方法。我可以创建一个平等助手并执行 {{#if equal myhelper true}} 但这看起来不是很干净。

有没有人有更好的想法?

最佳答案

我认为您应该能够使用 #unless空格键得到你想要的:

<template name="mytemplate">
{{#unless myhelper}}
myhelper is false
{{/unless}}
</template>

关于javascript - 如何不做 helper ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34362749/

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