我有一个这样的 freemarker 宏。
<#assign xmlNode = parseXML("<field name='dropDown' type='select' valueName='COUNTRY'/>")>;
<#import "utilFields.ftl" as util />
<div>
<@util.createDropdown field=xmlNode/>
</div>
我如何从 Javascript 调用相同的宏?
试过:
<#assign xmlNode = parseXML("<field name='dropDown' type='select' valueName='COUNTRY'/>")>;
<script type="text/javascript">
var dropdown = "${util.createDropdown(xmlNode)}";
alert(dropdown);
</script>
错误
FreeMarker template error:
A macro cannot be called in an expression.