问题
I didn't find this was possible in Handlebars... I need something like this:
{{#if A || B || C}} something {{/if}}
Is that possible to achieve? I have looked at this answer, but as I need for 3 variables (A, B, C) I don't really know how to apply it. Any ideas?
回答1:
They do not have multiple conditions. But you can achieve it by nesting. This works:
{{#if A}}
{{#if B}}
{{#if C}}
something
{{/if}}
{{/if}}
{{/if}}
回答2:
What about this?
{{#if A}}
something
{{else if B}}
someting B
{{else if C}}
someting C
{{/if}}
来源:https://stackoverflow.com/questions/41251635/handlebars-multiple-conditions-if-statement