gpt4 book ai didi

meteor - 为什么 If/Else 空格键标签不起作用?

转载 作者:行者123 更新时间:2023-12-02 09:33:51 25 4
gpt4 key购买 nike

嘿,出于某种原因,我模板中的这个 if/else 语句不起作用:

<div class="col-md-4">
<div class="row">
<div id="custom-search-input">
<div class="form-group col-md-12">
<div class="input-group col-md-12">
{{#if addingSubreddit}}
<input class="form-control input-lg" type="text">
<span class="input-group-btn" style="width: 2%;">
<button class="btn btn-info btn-lg" id="addSubreddit" type="submit">
<i class="glyphicon glyphicon-plus"></i>
</button>
{{else}}
<button id="newSubreddit" class="btn btn-info btn-lg" type="submit">
<i class="glyphicon glyphicon-plus"></i>
</button>
{{/if}}
</span>
</div>
</div>
</div>
</div>
</div>

它给我这个错误:

Your app is crashing. Here's the latest log.

Errors prevented startup:

While building the application:
client/views/subreddits.html:14: Unexpected {{else}}
...n> {{else}} hey ...
^

Your application has errors. Waiting for file change.

我不明白为什么这不起作用?

最佳答案

您放错了 span 标签。你在 span 标签外编码了 {{#if}} 但在标签内编码了 {{else}} 这是错误的。

相反,这可能会解决问题:

<div class="col-md-4">
<div class="row">
<div id="custom-search-input">
<div class="form-group col-md-12">
<div class="input-group col-md-12">
{{#if addingSubreddit}}
<input class="form-control input-lg" type="text">
<span class="input-group-btn" style="width: 2%;">
<button class="btn btn-info btn-lg" id="addSubreddit" type="submit">
<i class="glyphicon glyphicon-plus"></i>
</button>
</span>
{{else}}
<span class="input-group-btn" style="width: 2%;">
<button id="newSubreddit" class="btn btn-info btn-lg" type="submit">
<i class="glyphicon glyphicon-plus"></i>
</button>
</span>
{{/if}}
</div>
</div>
</div>

关于meteor - 为什么 If/Else 空格键标签不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29670996/

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