简单的方法来摆脱大括号? [英] Simple way to escape curly braces?

查看:118
本文介绍了简单的方法来摆脱大括号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法可以用Handlebars创建一个字符串{value}?也许类似于:

Is there a simple way to build a string "{value}" with Handlebars? Perhaps something analogous to:

Handlebars.compile("\{{{var}}\}")({var:"value"})


推荐答案

Handlebars支持空格字符。以下内容应该适用:

Handlebars support whitespace with the ~ character. The following should work

Handlebars.compile("{ {{~var~}} }")({var:"value"})

这篇关于简单的方法来摆脱大括号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆