在<script type =“ text / x-handlebars-template”>车把模板中使用助手

时间:2019-08-27 14:01:31

标签: javascript handlebars.js

我将handlebars.js与keystone.js一起使用。因此,为了将值嵌入我的<script type="text/x-handlebars-template">模板中,我在句柄表达式之前添加\。像这样:

<script type="text/x-handlebars-template">
   <img src="\{{mainImage}}">
</script>

问题在于嵌入辅助值。我尝试使用默认的cloudinaryUrl助手,但是它不起作用:

<script type="text/x-handlebars-template">
   <img src="\{{{cloudinaryUrl mainImage quality='auto' format='jpg'}}}"
</script>

我在控制台中看到Missing helper: "cloudinaryUrl"消息。 我该如何解决?

0 个答案:

没有答案