首页 > 解决方案 > 如何在 Handlebar HBs 引擎中使用 If 条件

问题描述

我已经使用这种和平的代码并面临一个错误,正如我在下面提到的第 26 行解析错误:... {{#if (error !="")}} <

期待 'CLOSE_RAW_BLOCK'、'CLOSE'、'CLOSE_UNESCAPED'、'OPEN_SEXPR'、'CLOSE_SEXPR'、'ID'、'OPEN_BLOCK_PARAMS'、'STRING'、'NUMBER'、'BOOLEAN'、'UNDEFINED'、'NULL'、'数据','SEP',得到'无效'

如何解决这个问题?

我在 hbs 中使用的代码是

       {{#if (error !="")}}  
    <div
      class="alert alert-danger alert-dismissible fade show"
      role="alert"
    >
      <strong> Error </strong>
      {{error}}
      <button
        type="button"
        class="btn-close"
        data-bs-dismiss="alert"
        aria-label="Close"
      ></button>
    </div>

    {{/if}}

标签: node.jsexpresssyntax-errorhandlebars.js

解决方案


推荐阅读