车把模板:
<script id="address_template" type="text/x-handlebars-template">
<fieldset class="form-fieldset">
<div class="form-row form-row--half">
\{{#each fields}}
\{{{dynamicComponent 'components/common/forms'}}}
<!-- I also tried `fieldType` instead of `dynamicComponent` -->
\{{/each}}
</div>
</fieldset>
</script>
在上面的代码forms
中是一个模板组件。
车把脚本:
<script type="text/javascript">
var template = $("#address_template").html();
var compiledCode = Handlebars.compile(template);
var result = compiledCode({fields: state.data.getShippingAddressFields()});
$('body').html(result);
</script>
错误:
缺少帮助程序:“dynamicComponent””
如何注册forms
组件?