我尝试像这样重写规则模板:
$(queryBuilderId).queryBuilder({
templates: {
rule: '\
<div id="{{= it.rule_id }}" class="rule-container"> \
<div class="rule-header"> \
<div class="btn-group pull-right rule-actions"> \
<button type="button" class="btn btn-xs btn-danger" data-delete="rule"> \
<i class="{{= it.icons.remove_rule }}"></i> {{= it.translate("delete_rule") }} \
</button> \
</div> \
</div> \
{{? it.settings.display_errors }} \
<div class="error-container"><i class="{{= it.icons.error }}"></i></div> \
{{?}} \
<div class="rule-filter-container"></div> \
<div class="rule-operator-container"></div> \
<div class="rule-value-container"></div> \
</div>'
}
})
我在标题中包含了 doT.js,但是 twig 向我抛出了这个错误:
Unexpected token "operator" of value "=".
有人知道我如何在我的 twig 文件中使用 doT.js 模板语法吗?